xHarbour Reference Documentation > Function Reference |
Suspends the current thread until all other threads have terminated.
WaitForThreads() --> NIL
The return value is always NIL.
Function WaitForThreads() is only effective when it is called in the Main thread of an xHarbour application. This is the thread executing the first function, or start routine, of the application. WaitForThreads() suspends the Main thread until all other threads have terminated. This makes sure that only the Main thread is active when the function returns. If WaitForThreads() is called in a different thread than the Main thread, it returns immediately and does not suspend thread execution.
Note: when a thread, other than the Main thread, should wait for the termination of a second thread, function JoinThread() can be used.
See also: | GetCurrentThread(), GetThreadID(), HB_MutexCreate(), JoinThread(), StartThread(), StopThread(), ThreadSleep() |
Category: | Multi-threading functions , xHarbour extensions |
Source: | vm\thread.c |
LIB: | xhbmt.lib |
DLL: | xhbmtdll.dll |
http://www.xHarbour.com