void myThread(void *arg) {
printf("Thread ran!\n");
pthread_exit( NULL );
}
int main() {
int ret;
pthread_t mythread;
ret=pthread_create(&mythread,NULL,myThread,NULL);
if (ret != 0) {
printf( "Can’t create pthread (%s)\n", strerror(errno ) );
exit(-1);
}
return 0;
}
void myThread(void *arg) { printf(Thread ran!\n); pthread_exit( NULL ); } int main() { int
Share
You have to wait in the main thread, use
pthread_join()after callingpthread_create().