Older Newer
Wed, 18 Jun 2008 11:33:33 . . . . afh [add anchor links]

Changes by last author:

= terminateThread =

== Syntax ==

:bool terminateThread(int hThread)

== Arguments ==


:: Specifies the handle of the thread which we wish to terminate, or 0 to terminate all current worker threads.

== Return ==

:Returns true if all specified threads have terminated, or false if an error occurred.

== Description ==

:Use this function to terminate one or all worker threads that were created by calling triggerThread. To terminate one particular thread, set the hThread parameter to the value of the thread handle that was returned by the call to triggerThread. To terminate all current worker threads, set the hThread parameter to 0.



:Note: This API can be dangerous to use, since forcibly terminating a thread can result in failure to release resources owned by the thread, and DLLs attached to the thread are not notified that the thread is terminating. Use this API only when absolutely necessary. For more details, see the documentation of the Windows [TerminateThread API].

== Example ==

:See the example in triggerThread.

== Also see ==

:System Functions, Multithreading Functions, countProcessors, triggerThread, waitForThread, isThreadActive, getThreadRetVal

== Comments ==

*The current implementation of terminateThread recognizes only a parameter of 0 to terminate all threads; you cannot specify a thread handle to terminate a specific thread.

*Everyone can add his or her comments here about his or her experiences with this function. Tips for using it are welcome, too.