On 13/08/2013 16:09, Jerry James wrote:
There is a way to detect pthread exit. Create a pthread_key_t with a non-NULL destructor function, and set the value of that key to something non-NULL when a thread enters ML code for the first time. When that thread exits, the destructor function will be called. I whipped up an overly simplistic example to illustrate the approach. (Don't be too critical; I pumped this out pretty quickly.)
Hi Jerry, Thank you very much for that suggestion. I haven't tested it yet but it certainly looks as though it's the answer I wanted. This should be easy to add since there's already a pthread_key_t that points to the data; it's just that it doesn't have a destructor.
I did a search and found some suggestions which included using pthread_kill but that turned out to cause a crash.
Best regards, David