|
Ideally you would arrange to send some sort of message or event to the thread asking it to terminate itself (via ExitThread() or returning from threadproc), for clean-ness.
I'd really recommend *against* using ExitThread() if you want a thread to terminate itself. If you're using the C runtime [which is very likely if you're doing Lua stuff] you should give the runtime library the opportunity to clean up after itself. This is important since the runtime library probably maintains thread-specific data. Calling ExitThread directly will almost certainly result in memory leaks. The best way to have a thread kill itself is (as you mentioned) to have it return. The next-to-best way is to have it call _endthread()/_endthreadex() [depending on how your thread was created]. Ashwin. -- no signature is a signature