PDA

View Full Version : Thread callback



Robertoc
04-14-2015, 09:12 AM
Hi all,

I have been using SourcePro 12.0 as threading library and I am in the need to perform a certain operation on thread local storage data upon thread termination.

I have been having 2 issues so far:


I register a callback for the RW_THR_TERMINATING state change, but the callback never fires. The thread's state machine (http://docs.roguewave.com/sourcepro/12.0/html/threadsug/3-5.html#Figure%207) identifies 3 states as exit states and the mask I use should catch them all (RW_THR_TERMINATING | RW_THR_EXCEPTION | RW_THR_CANCELING | RW_THR_CALL_REPEATEDLY).
In order to check that the callback was properly installed I added RW_THR_RUNNING to the mask, and the callback is called in this case. Has anyone had the same issue?
The second issue is the problem I will have if I manage to get around the first issue: the library does not guarantee that the callback is executed by the thread the callback has been registered for. This is an issue for me because the callback has to deal with TLS data. Is there any way to enforce that the callback will be executed by the thread I registered it for?


Thanks in advance!

Roberto.