Method Signal():wait() Foundation

Waits until another thread triggers the signal

Syntax
:wait( [<nTimeOut>], [<lReset>] ) --> lSignalled
Parameters
<nTimeOut>
<nTimeOut> is a positive integer specifying a time interval in increments of 1/100ths of a second. The thread waits for a signal until this interval has elapsed. The default is 0 which causes a thread to wait indefinitely until another thread calls the :signal() method. If <nTimeOut> is greater than zero, then this is the maximum waiting time. When the time limit elapses without the thread being signalled, it resumes program execution.
<lReset>
<lReset> is a logical parameter specifying whether the object shall fall back to the non-signalled state after the thread, which is waiting for the signal is resumed. If <lReset> is .F. (false), then the signal object remains in the signalled state after the waiting thread is resumed. This can be useful when more than one thread is synchronized with one instance of the signal class. The parameter <lReset> defaults to .T. (true). So the object is in the non-signaled stated after the calling thread is resumed.
Return

The method returns .T. (true) when the thread is signalled. If the timeout interval elapses without a signal being triggered, the return value is .F. (false).

Description

A thread enters a wait state when it executes the :wait() method. The thread remains active while waiting but it does not consume CPU resources. This is analogous to the Sleep() function which causes a thread - literally spoken - to "go to sleep", to "wake up again" when a time interval has elapsed, and to resume program execution. However, the length of the waiting period is not determined with the :wait()method. A thread leaves its wait state ("wakes up") as soon as another thread executes the :signal() method with the same Signal object, or when the timeout is reached. All threads using the same Signal object will leave their wait state once the signal is triggered by another thread (1:N relationship, N threads may wait while one thread signals).

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.