xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

KillAllThreads()

Kills all running threads except for the main thread.

Syntax

KillAllThreads() --> NIL

Return

The return value is always NIL.

Description

Function KillAllThreads() is provided for "emergency recovery", such as dead locks between threads, and may only be called in the main thread of an xHarbour application. The function sends a thread termination request to the operating system for all threads but the main thread, and returns immediately. It does not guarantee that threads have actually terminated when the function returns. Use WaitForThreads() to make sure all threads have terminated.

Important:  if a call to KillAllThreads() becomes necessary, the program logic of the multi-threading application should be carefully revised. It is an indication for an error in the usage of multiple threads.

Info

See also:HB_MutexCreate(), KillThread(), StartThread(), StopThread(), ThreadSleep(), WaitForThreads()
Category: Multi-threading functions , xHarbour extensions
Source:vm\thread.c
LIB:xhbmt.lib
DLL:xhbmtdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe