Signaler of relevant processing conditions.
class Event( [mode] ) \ from Waitable
reset() | Resets the event, preventing threads from acquiring it. |
set() | Sets the Event and allow a waiting thread to proceed. |
release from Waitable | Releases a structure acquired by a waiting function. |
class Event( [mode] ) \ from Waitable
mode | Set to true to create a manual reset event. |
Signaler of relevant processing conditions.
Falcon events can be used to signal that a certain condition is met, that a certain resource has become ready to be processed, or that shared data is now available for exclusive access.
Events start their activity in "reset state". When they are reset, a wait on them blocks any tread. When they are in "set" state, they become acquireable. Only one thread at a time can acquire a set event, and the acquiring threads holds exclusively the event structure untill it releases it.
When the event is acquired, if the event has been created as automatic, it is automically reset. New set requests can be then issued both by the acquiring thread and by other threads while the event is being held and the data associated to the event is processed. If the event is created in manual mode, the event is not reset at acquisition; if the conditions that the event has signaled is not anymore valid, the acquiring thread must reset the event before releasing it.
When the acquiring thread releases the event, if the event is still set (or if it has been set after the automatic or manual reset), another waiting thread can be immediately selected to proceed and acquire the event.
Events support late signaling. If the event is set when there isn't any thread waiting for it, the first thread trying to wait on that will proceed immediately, acquiring the event and being free to reset it.
Note: The semantic of this structure is slightly different from the sematic of the well known "Event Variable" in the MS-Windows SDK. Mainly, Falcon events allows only to one thread at a time to proceed, and grant atomicity of access to data associated with the event.
By default, this constructor creates an automatic event, whose set status is automatically reset as a thread is able to acquire it. To create a manual reset event, which must be reset by the acquiring thread when it finds that other threas could not progress, call this constructor with mode set to true.
Resets the event, preventing threads from acquiring it.
Event.reset( )
Sets the Event and allow a waiting thread to proceed.
Event.set( )