sync

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 1 Imported by: 0

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) Pause

func (c *Controller) Pause()

Pause sets the controller to a paused state

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL