Documentation ¶
Overview ¶
Package sync implements types to synchronise program execution
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements the ability to tell multiple goroutines to wait or resume based on a pause condition. At appropriate times goroutines should check if they should pause using the WaitIfPaused() method.
func NewController ¶
func NewController() *Controller
NewController returns a new controller to synchronise goroutines. The controller starts unpaused by default
func (*Controller) Paused ¶
func (c *Controller) Paused() bool
Paused returns whether the controller is currently pausing goroutines
func (*Controller) Resume ¶
func (c *Controller) Resume()
Resume wakes up all goroutines waiting on the controller and continues their execution
func (*Controller) WaitIfPaused ¶
func (c *Controller) WaitIfPaused()
WaitIfPaused causes the goroutine to wait if it is paused, until the Resume() function is called to continue execution