pthread_create()函数参数使用心得
时间:2005-09-29 来源:dubble
线程创建函数:
int pthread_create(pthread_t *tid, const pthread_attr_t *attr, void * (*func)(void *), void *arg);
参数func 表示代一个参数void *,返回值也为void *;
对于void *arg,参数传入,在gcc 3.2.2条件下,以下面两种方式传入都可编译通过。
int ssock;
int TCPechod(int fd);
1.pthread_create(&th, &ta, (void *(*)(void *))TCPechod, (void *)ssock);
2.pthread_create(&th, &ta, (void *(*)(void *))&TCPechod, (void *)&ssock);
相关阅读 更多 +
排行榜 更多 +