pthread_create函数的第三个参数加不加&有什么区别?
#include <stdio.h>
#include <pthread.h>
void *pthread_fun(void *arg)
{
while (1) {
sleep(1);
printf("pthread running\n");
}
return((void *)0);
}
int main()
{
pthread_t tid;
pthread_create(&tid, NULL, pthread_fun, NULL);
// pthread_create(&tid, NULL, &pthread_fun, NULL);
while (1) {
sleep(2);
printf("main runing\n");
}
return 0;
}
pthread_create的第三个参数,有的书加&,有的书不加,
有什么区别吗,请教大家!
Nixoo
12 years, 1 month ago