Documentation
¶
Overview ¶
Package syncutil provides mutex primitives with optional deadlock detection. Use build tag -tags=deadlock to enable deadlock detection during development.
Index ¶
Constants ¶
const DeadlockEnabled = false
DeadlockEnabled is true if the deadlock detector is enabled.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pauser ¶ added in v2.11.0
type Pauser struct {
// contains filtered or unexported fields
}
Pauser is a thread-safe pause/resume primitive using the closed-channel pattern. When not paused, Wait returns immediately. When paused, Wait blocks until Resume is called or the context is cancelled.
A nil *Pauser is safe to use: Wait always returns nil.
func NewPauser ¶ added in v2.11.0
func NewPauser() *Pauser
NewPauser returns a Pauser in the unpaused state.
func (*Pauser) IsPaused ¶ added in v2.11.0
IsPaused reports whether the Pauser is currently in the paused state.
func (*Pauser) Pause ¶ added in v2.11.0
func (p *Pauser) Pause()
Pause requests a pause. Idempotent: calling Pause when already paused is a no-op.
func (*Pauser) Resume ¶ added in v2.11.0
func (p *Pauser) Resume()
Resume unblocks all goroutines waiting in Wait. Idempotent: calling Resume when not paused is a no-op.