xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

WaitForThreads()

Suspends the current thread until all other threads have terminated.

Syntax

WaitForThreads() --> NIL

Return

The return value is always NIL.

Description

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.

Info

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


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