Documentation
¶
Overview ¶
Package events provides a single synchronization primitive - the Event. The event is used to notify that a condition has occurred to routines. Each event has two states - set and unset. Set state indicates the condition has occurred.
Multiple routines can wait on a condition. _All_ routines unblock once the event is set to the set state. A routine that waits on an event that is already set will not block.
The event primitive is similar to the event in the pSOS or ARINC 653 APIs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event interface {
// Set changes the specified event to the set state. All the routines waiting
// on the event will stop waiting. Any subsequent routine attempting to wait will not block until the
// event is set to the unset state again.
// Returns true if the event changed.
Set() bool
// Resets the specified event to the unset state. Once reset, any routine attempting to wait
// will block until the event is set again. Returns true if the event changed.
Reset() bool
// Checks if the specified event is in set state.
IsSet() bool
// Wait for the event to be in the set state. Any routine that attempts to wait on an event
// already in the set state will not block.
Wait()
// Wait for the event to be in the set state up to the given timeout. Any routine that attempts to wait
// on an event already in the set state will not block.
TimedWait(timeout time.Duration) bool
}
Multiple routines can wait on a condition. _All_ routines unblock once the event is set to the set state. A routine that waits on an event that is already set will not block.