Documentation ¶
Overview ¶
Package synchrozine provides an instrument for synchronization of multiple goroutines over a single channel. It provides the main channel (`chan error`), as well as tools for complete synchronization and receivers a channels list to send finish signals to goroutines.
Synchrozine supports the startup synchronization and thread-safe injections.
Index ¶
- type Synchrozine
- func (s *Synchrozine) Add()
- func (s *Synchrozine) AddMany(count int)
- func (s *Synchrozine) Append() <-chan struct{}
- func (s *Synchrozine) Done()
- func (s *Synchrozine) Inject(err error)
- func (s *Synchrozine) StartupSync(ctxFactory func() context.Context) error
- func (s *Synchrozine) Sync(ctxFactory func() context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Synchrozine ¶
type Synchrozine struct {
// contains filtered or unexported fields
}
Synchrozine is an instrument for synchronization of multiple goroutines over a single channel. It provides the main channel (`chan error`), as well as tools for complete synchronization and receives a channels list to send finish signals to goroutines.
func (*Synchrozine) Add ¶
func (s *Synchrozine) Add()
Add increments a counter of controlled goroutines.
func (*Synchrozine) AddMany ¶
func (s *Synchrozine) AddMany(count int)
AddMany increments a counter of controlled goroutines on the specified value.
func (*Synchrozine) Append ¶
func (s *Synchrozine) Append() <-chan struct{}
Append decrements a startup counter and returns a read-only channel.
func (*Synchrozine) Done ¶
func (s *Synchrozine) Done()
Done decrements a counter of controlled goroutines.
func (*Synchrozine) StartupSync ¶
func (s *Synchrozine) StartupSync(ctxFactory func() context.Context) error
StartupSync waits for all appended goroutines to start.