Please take a look at the following small programs.
#include #include
Void * threadtask; "VOID * ARG);
int main (void) {int status; char ch; pthread_t MyThread; void * result; status = pthread_create (& MyThread, NULL, ThreadTask, NULL); if (status = 0!) printf ( "thread create error / n"); Sleep (3); pthread_cancel (mythread); Printf ("come to here / n"); pthread_join (mythread, & result); Printf ("exit ........... / n"); return; } void * threadtask (void * arg)
{INT A; while (1) {a = 1; SLEEP (1);}}
It only runs to the screen print output "come to here", it will die there. . . .
What is going on? ? ? ? ? ?
Thank you