Documentation ¶
Overview ¶
Package cond implements a context-aware condition variable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cond ¶
Cond is a context-aware version of a sync.Cond. Like a sync.Cond, a Cond must not be copied after first use.
func (*Cond) Wait ¶
Wait behaves identically to sync.Cond.Wait, except that it respects the provided context. Specifically, if the context is cancelled, c.L is reacquired and ctx.Err() is returned. Example usage:
for !condition() { if err := cond.Wait(ctx); err != nil { // The context was cancelled. cond.L is locked at this point. return err } // Wait returned normally. cond.L is still locked at this point. }
Click to show internal directories.
Click to hide internal directories.