Does anyone have a good example of using pthread_kill()?
Here is how I'm executing it, test-wise. When signal() and
pthread_kill() are executed, they return 0 (no err), but the
thread continues to execute.
volatile int sigCaught = 0;
void func1(char cmd)
{
switch (cmd)
{
case START_THREAD_1:
signal(SIGINT,sigFunc);
pthread_create(&thrdHndl,NULL,(void*) thread_1,(void*) "-");
break;
case KILL_THREAD_1:
pthread_kill(thrdHndl,SIGINT);
break;
}
}
void sigFunc(int sigNum)
{
sigCaught = 1;
}
void thread_1()
{
while (1)
{
printf("I'm active\n");
delay();
}
}
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com