Method Signal():waitAll() Foundation

Waits for multiple signals to be posted simultaneously.

Syntax
:waitAll( <aoSignal>, [<nHSecs>], [<lReset>] ) --> lSignaled
Parameters
<aoSignal>
Array of Signal objects to wait on. All must be signaled for success.
<nHSecs>
Optional timeout in hundredths of seconds. A value of 0 or if the parameter is omitted means wait indefinitely.
<lReset>
Optional logical value. The default value .T. (true) resets all signals after successful wait, .F. (false) leaves them signaled.
Return

.T. (true) if all signals were received, .F. (false) if a timeout or an error occurred.

Description

The :waitAll() method blocks the calling thread until ALL Signal objects in the provided array have been signaled, or until the specified timeout expires. This is useful for coordinating multiple asynchronous operations where you need to wait for all of them to complete before proceeding.

This method implements a barrier synchronization pattern where a thread needs to wait for multiple conditions to be met. Unlike waiting on signals individually, :waitAll() ensures that the thread proceeds only when every signal in the array has been posted at least once.

The method atomically checks all signals, preventing race conditions that could occur if you were to check each signal individually in a loop.

Feedback

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.