Documentation ¶
Overview ¶
Package criticalsection is discontinued. Please visit: github.com/orkunkaraduman/go-syncex
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotLocked = errors.New("not locked")
)
Library specific errors.
Functions ¶
This section is empty.
Types ¶
type CriticalSection ¶
type CriticalSection struct {
// contains filtered or unexported fields
}
A CriticalSection is a kind of lock like mutex. But it doesn't block first locked goroutine/section again.
A CriticalSection must not be copied after first use.
func (*CriticalSection) Lock ¶
func (cs *CriticalSection) Lock()
Lock locks cs. If the lock is already in use different goroutine, the different goroutine blocks until the CriticalSection is available.
func (*CriticalSection) LockSection ¶
func (cs *CriticalSection) LockSection(sc Section)
LockSection locks cs by given section. LockSection is faster than Lock(). If the lock is already in use different section, the different section blocks until the CriticalSection is available.
func (*CriticalSection) Unlock ¶
func (cs *CriticalSection) Unlock()
Unlock unlocks cs. It panics if cs is not locked on entry to Unlock.