声明同上一篇文章,以下是代码
#include <cmnheader.h>
const int THREADFAIL = 1;
const int THREADPASS = 0;
void *theThread(void *parm)
{
printf("Thread: End with success\n");
pthread_exit(__VOID(THREADPASS));
printf("Thread: Did not expect to get here!\n");
return __VOID(THREADFAIL);
}
int main(int argc, char **argv)
{
pthread_t thread;
int rc = 0;
void *status;
printf("Enter Testcase - %s\n", argv[0]);
printf("Create/start a thread\n");
rc = pthread_create(&thread, NULL, theThread, NULL);
checkResults("pthread_create()\n", rc);
printf("Wait for the thread to complete, and release its resources\n");
rc = pthread_join(thread, &status);
checkResults("pthread_join()\n", rc);
printf("Check the thread status\n");
if (__INT(statu