Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotLocked = errors.New("not locked")
)
Package specific errors.
Functions ¶
Types ¶
type CriticalSection ¶
type CriticalSection struct {
// contains filtered or unexported fields
}
A CriticalSection is particular type of mutual exclusion (mutex) that may be locked multiple times by the same owner.
The CriticalSection is faster than RecursiveMutex.
A CriticalSection must not be copied after first use.
func (*CriticalSection) Lock ¶
func (cs *CriticalSection) Lock(ownerID uint64)
Lock locks cs with given ownerID. If cs is already owned by different owner, it waits 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.
type RecursiveMutex ¶ added in v1.1.0
type RecursiveMutex struct {
// contains filtered or unexported fields
}
A RecursiveMutex is particular type of mutual exclusion (mutex) that may be locked multiple times by the same goroutine.
A RecursiveMutex must not be copied after first use.
func (*RecursiveMutex) Lock ¶ added in v1.1.0
func (rm *RecursiveMutex) Lock()
Lock locks rm. If rm is already owned by different goroutine, it waits until the RecursiveMutex is available.
func (*RecursiveMutex) Unlock ¶ added in v1.1.0
func (rm *RecursiveMutex) Unlock()
Unlock unlocks rm. It panics if rm is not locked on entry to Unlock.
type ReentrantMutex ¶
type ReentrantMutex RecursiveMutex
ReentrantMutex is synonym for RecursiveMutex.