README

syncex

GoDoc

Extended synchronization for GoLang.

syncex includes:

  • RecursiveMutex (ReentrantMutex)
  • CriticalSection
Expand ▾ Collapse ▴

Documentation

Index

Constants

This section is empty.

Variables

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

    Package specific errors.

    Functions

    func NewOwnerID

    func NewOwnerID() uint64

      NewOwnerID gives a new ownerID incrementally.

      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

            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

              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

                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.