go-syncex: github.com/orkunkaraduman/go-syncex Index | Files

package syncex

import "github.com/orkunkaraduman/go-syncex"

Index

Package Files

criticalsection.go error.go recursivemutex.go reentrantmutex.go utils.go

Variables

var (
    ErrNotLocked = errors.New("not locked")
)

Package specific errors.

func NewOwnerID Uses

func NewOwnerID() uint64

NewOwnerID gives a new ownerID incrementally.

type CriticalSection Uses

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 Uses

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 Uses

func (cs *CriticalSection) Unlock()

Unlock unlocks cs. It panics if cs is not locked on entry to Unlock.

type RecursiveMutex Uses

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 Uses

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 Uses

func (rm *RecursiveMutex) Unlock()

Unlock unlocks rm. It panics if rm is not locked on entry to Unlock.

type ReentrantMutex Uses

type ReentrantMutex RecursiveMutex

ReentrantMutex is synonym for RecursiveMutex.

Package syncex imports 6 packages (graph). Updated 2019-02-17. Refresh now. Tools for package owners.