Multiple threads in C program

前端 未结 5 1271
北海茫月
北海茫月 2020-12-19 12:10

I\'m writing a Unix application in C which uses multiple threads of control. I\'m having a problem with the main function terminating before the thread it has spawned have a

5条回答
  •  情书的邮戳
    2020-12-19 12:30

    You may want to look at this page: http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/apis/users_25.htm

     rc = pthread_create(&thread, NULL, threadfunc, NULL);
      checkResults("pthread_create()\n", rc);
    
      printf("Wait for the thread to exit\n");
      rc = pthread_join(thread, &status);
    

提交回复
热议问题