How to terminate a thread and avoid any resource from leaking?
Posted on 2003-10-08 05:21:41 by optimus
exitthread i'd imagine or alternatively a ret on the thread code (which rets it to exitthread anyway)....
Posted on 2003-10-08 07:54:35 by evlncrn8
Is that enough and will not cause any resource leak?
Posted on 2003-10-08 09:42:48 by optimus
All handles to the thread also need to be closed. Any resources allocated by the thread obviously need to be at some point freed as well.
Posted on 2003-10-08 16:18:05 by Mecurius
Good point, Mecurius... most people probably don't know that:


The thread object remains in the system until the thread has terminated and all handles to it have been closed through a call to CloseHandle.

...funny how so many assembly programmers seem to ignore the things stated in the PlatformSDK.
Posted on 2003-10-09 07:29:36 by f0dder