Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock is a channel based lock with TryLock() supported, it is designed for very low contention scenario
func (*Lock) Lock ¶
func (l *Lock) Lock()
Lock blocks the calling thread until the lock is acquired.
type Stopper ¶
type Stopper struct {
// contains filtered or unexported fields
}
Stopper is a manager struct for managing worker goroutines. It is modified from an early version of the stopper struct found in CockroachDB's codebase.
func (*Stopper) Close ¶
func (s *Stopper) Close()
Close closes the internal shouldStopc chan struct{} to signal all worker goroutines that they should stop.
func (*Stopper) RunNamedWorker ¶
RunNamedWorker creates a new gorotuine and invoke the f func in that new worker goroutine. The specified name is to identify the worker, it is typically used for debugging purposes.
func (*Stopper) RunWorker ¶
func (s *Stopper) RunWorker(f func())
RunWorker creates a new goroutine and invoke the f func in that new worker goroutine.
func (*Stopper) ShouldStop ¶
func (s *Stopper) ShouldStop() chan struct{}
ShouldStop returns a chan struct{} used for indicating whether the Stop() function has been called on Stopper.