Documentation
¶
Overview ¶
SPDX-License-Identifier: Apache-2.0 OR MIT
jsync is a package that implements various synchronisation helpers that are missing from sync. It does not and will not rely on golinkname to be portable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FWaitGroup ¶
type FWaitGroup struct {
// contains filtered or unexported fields
}
FWaitGroup is a sync.WaitGroup like object that invokes some function when the count reach 0. The function will be called synchronously when the Done is called. This is intended for asynchronous cleanup work like closing a channel shared my multiple workers. The transition to 0 must only ever happen once, else who knows what will happen ? (this should be caught by the race dectector)
func NewFWaitGroup ¶
func NewFWaitGroup(f func(), initial uint64) *FWaitGroup
initial must not be 0, if you plan to use .Add then use 1 in your constructor and call .Done once the constructor is done.
func (*FWaitGroup) Add ¶
func (fwg *FWaitGroup) Add()
func (*FWaitGroup) Done ¶
func (fwg *FWaitGroup) Done()
func (*FWaitGroup) Init ¶
func (fwg *FWaitGroup) Init(f func(), initial uint64)
Init is an alternative to NewFWaitGroup that allows to embed in your own fields. initial must not be 0, if you plan to use .Add then use 1 in your constructor and call .Done once the constructor is done.
type NoCopy ¶
type NoCopy struct{}
NoCopy is a type that does nothing, it implements sync.Locker to be recognised by the nocopy check of go vet. To use it add it as a first blank field in your structs: _ jsync.NoCopy Calling the methods panics.