PThread Handles Not Closing?
Is there a CloseHandle For PThreads?
Im using somewhat portable code, and while watching my code execute via process explorer, im noticing that the software is generating huge numbers of thread handles but never destroying them. Im using the posix thread lib, and the threads appear to be terminating, however the thread handles never close. I have tried pthread_exit in the thread itself, and outside i have attempted pthread_cancel, pthread_kill, pthread_join, and delete thread. While the thread is no longer processing anything, it never closes its handle and in turn causes a memory leak. The threads themselves are in an overly simple wrapper class, constructor creating the thread datamember, and calling pthread_create. The kill code is in the objects destructor. When the thread is done, it deletes the wrapper thus killing itself (which is possibly where the problem is?)
I have also experimented with an external cleanup thread running, issueing kills to the worker threads once they are finished, and have not had any successful results.
Any help would be greatly appreciated. Is there a tool i can use to determine exactly where in my code the leak happens? Thanks for your time.