Documentation ¶
Overview ¶
Package trigger implements an edge-triggered condition variable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cond ¶
type Cond struct {
// contains filtered or unexported fields
}
A Cond is an edge-triggered condition shared by multiple goroutines. The Cond.Ready method returns a channel that is closed when the condition is activated.
When a condition is first created it is inactive. It remains inactive until Cond.Set or Cond.Signal is called, either of which causes the current ready channel to be closed. Once a condition has been activated, it remains active until it is reset. Use Cond.Reset to make it inactive.
The Cond.Signal method activates and then immediately resets the condition, acting as Set and Reset done in a single step.
A zero Cond is ready for use, and is inactive, but must not be copied after any of its methods have been called.
func (*Cond) Ready ¶
func (c *Cond) Ready() <-chan struct{}
Ready returns a channel that is closed when t is activated. If t is active when Ready is called, the returned channel will already be closed.
func (*Cond) Reset ¶
func (c *Cond) Reset()
Reset resets the condition. If it was already inactive, Reset has no effect.
func (*Cond) Set ¶
func (c *Cond) Set()
Set activates the condition. If it was already active, Set has no effect.
func (*Cond) Signal ¶
func (c *Cond) Signal()
Signal activates and immediately resets the condition. If the condition was already active, this is equivalent to Cond.Reset.