C++: How does pthread_cancel() work?
Christian Fröbel
cfroebel@web.de
Tue Feb 2 08:26:00 GMT 2010
Hi all,
I'm having a hard time figuring out how exactly pthread_cancel() works
in a C++ program. It seems that a thread cancellation is somewhat
similar to throwing an exception. But I couldn't find any proof or
details about it. I'm not even sure this topic is gcc-relevant but
hope someone can lighten up this issue.
I first came across this issue when I found a thread's main function
which enclosed most of it's parts in a try-catch(...)-block -- without
re-throwing anything. When that thread was subject to cancellation,
the program crashed in the catch(...)-block (I think).
So how exactly does pthread_cancel() work in C++?
Is it similar to exception handling -- so will destructors be called?
What exactly caused the crash described above?
Kind regards,
Christian
More information about the Gcc
mailing list