synchronizer

package
v4.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: Apache-2.0 Imports: 2 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Synchronizer

type Synchronizer struct {
	// contains filtered or unexported fields
}

Synchronizer keeps track of a reference counter. It is useful to keep track of outstanding tasks that run in goroutines.

func NewSynchronizer

func NewSynchronizer(onSyncStarted func(), onSyncFinished func(), log *logrus.Entry) *Synchronizer

NewSynchronizer creates a new Synchronizer. onSyncStarted is called when the counter is first incremented. onSyncFinished is called when the counter is last decremented.

func (*Synchronizer) IncRequestsCounter

func (synchronizer *Synchronizer) IncRequestsCounter() func()

IncRequestsCounter increments the counter, and returns a function to decrement it which must be called after the task has finished.

func (*Synchronizer) WaitSynchronized

func (synchronizer *Synchronizer) WaitSynchronized()

WaitSynchronized blocks until all pending synchronization tasks are finished.

Jump to

Keyboard shortcuts

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