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.
Click to show internal directories.
Click to hide internal directories.