$ vim test.c
#include <stdio.h>
#include <pthread.h>
void* thread_func(void* p)
{
int i;
for(i=0;i<10;i++)
printf("%d\n",i);
fflush(stdout);
return NULL;
}
int main(int argc,char **argv)
{
pthread_t tid;
pthread_create(&tid,NULL,&thread_func,NULL);
if(tid<0)
printf("error\n");
return 0;
}
$ cc -lpthread test.c -o test
$ ./test
$
Числа не выводятся. В чем тут ошибка? Пробовал pthread_join после pthread_create - то же самое.