_endthread in DLL Process Detach
Posted on 1997-10-30
I have a NT 32 bit DLL that creates a helper thread in the PROCESS_ATTACH using _beginthread(). When I load the DLL through a VB app, everything works fine until I end the app. That's when I get an ACCVIO out of VB. I think the problem is that I try to end the thread out of the PROCESS_DETACH. I set an event, which I WaitOnSingleObject() for in the ThreadProc. I think that the problem has something to do with NT wanting to serialize thread activity with the DLLMain callls in my DLL.
Anyway, my question is:
How can I end this thread without ACCVIO'ing given that I don't know to end the thread until I get the PROCESS_DETACH.