Multiple Signal objects can be used to control program execution in multiple threads. Since a Signal object limits program control in threads to a wait state, so-called "dead lock" situations can occur when multiple Signal objects are used. A dead lock is reached when thread A waits for a signal from thread B, while, at the same time, thread B waits for a signal from thread A.
Class Signal() Foundation
Class function of the Signal class.
Signal objects are used to control program flow within one or more threads from one other thread. To achieve this, it is necessary that one and the same Signal object is visible in at least two threads. Therefore, Signal objects can only be used in conjunction with Thread objects. In other words, at least one additional Thread object must exist in an application for the Signal class to become useful (note: the Main procedure is executed by an implicit Thread object).
There are two methods in the Signal class: :signal() and :wait(). The method :signal() triggers a signal, while the :wait() method causes a thread to enter a wait state. If a thread executes the :wait()method, it waits for the signal and suspends program execution. The thread resumes as soon as a second thread executes the :signal()method with the same Signal object.
With the aid of Signal objects it becomes possible for the current thread to control program flow in other threads. Each thread which executes the :wait() method enters a wait state until another thread executes the :signal() method.
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.