
8 Nov
2009
8 Nov
'09
7:38 p.m.
cowwoc wrote:
One of my threads has the following logic:
{ at_thread_exit(myHook); while (!shutdownRequested) { // do stuff } }
myHook() { shutdownRequested = true; }
Following your scenario, doesn't this mean that the shutdown hook will never get executed? What will happen? Will exit() hang forever?
It will never get executed. The hook is executed AFTER the thread exits. exit() will not hang, it will just terminate the thread (and all other threads) as its very last step (after invoking the atexit handlers and global/static destructors).