Function ThreadWaitAll() Foundation

Waits for the termination of multiple threads

ThreadWaitAll( <aThreads> , ;
              [<nTimeOut>]  ) --> lSuccess
<aThreads> is an array whose elements contain Thread objects. The current thread waits for the termination of all of the corresponding threads. The number of elements in <aThreads>, or thread objects, respectively, is limited to the value of the constant THREAD_WAIT_MAX from THREAD.CH.
<nTimeOut> specifies the maximum amount of time the current thread will wait for the termination of all other threads. The unit is 1/100th of a second. The default value is 0 and this causes the current thread to wait infinitely until all other Thread objects are finished with executing code. If a value > 0 is specified for <nTimeOut> and no thread has terminated within this period of time, the current thread resumes progam execution.

When all threads specified in <aThreads> have terminated, the return value is .T. (true). If the waiting period is limited by a value greater than 0 for <nTimeOut> and not all threads have terminated when this time limit has expired, the function returns .F. (false).


The function ThreadWaitAll() causes the current thread to wait for the termination of multiple other threads. Compared to the :synchronize() method of the Thread class, it has the advantage that the current thread does not need to wait for one particular Thread object but rather can wait for multiple threads to complete execution of code.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.