In the last episode (Aug 11), Mirar @ Pike developers forum said:
That sounds like it could lead to very interesting memory leaks?
You've got a couple choices: You can disable cancels, which really queues then instead of disabling them. A thread can run pthread_testcancel() to check to see if it must exit. That's probably the easist to integrate into pike, since you can choose when to check for cancellation, but won't help if you have a thread stuck in a C loop.
The other option is to leave cancels enabled and use a thread cleanup handler to clean up local resources. You would likely leak any memory allocated by C modules unless they were thread-aware enough to push their own cleanup handlers.
http://docs.sun.com/db/doc/816-0216/6m6ngupgl?a=view http://www.opengroup.org/onlinepubs/009695399/functions/pthread_setcancelsta...