Well, in light of the latest info provided by Codeplug, you'd probably be better off by adding some Initialize/Uninitialize functions to your dll, do thread signaling/waiting in Uninitialize() which you call before you exit the process.