pthread_kill()

Why this thread continue its execution though I kill it??

1
2
3
4
pthread_t pid;
pthread_create(&pid, NULL, (func)countdown, NULL);
pthread_kill(pid, 1);
pthread_join(pid, NULL);
pthread_kill doesn't kill anything, it sends a signal (SIGHUP in this case). The default handler is actually supposed to terminate the entire program: do you have a complete, compilable example?

(note that thread killing is very hard to do right: C++ doesn't even allow it)
pthread_cancel(pid);

Can this function terminate this thread?
Topic archived. No new replies allowed.