Documentation

Overview

    Package tmutex provides the implementation of a mutex that implements an efficient TryLock function in addition to Lock and Unlock.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type Mutex

    type Mutex struct {
    	// contains filtered or unexported fields
    }

      Mutex is a mutual exclusion primitive that implements TryLock in addition to Lock and Unlock.

      func (*Mutex) Init

      func (m *Mutex) Init()

        Init initializes the mutex.

        func (*Mutex) Lock

        func (m *Mutex) Lock()

          Lock acquires the mutex. If it is currently held by another goroutine, Lock will wait until it has a chance to acquire it.

          func (*Mutex) TryLock

          func (m *Mutex) TryLock() bool

            TryLock attempts to acquire the mutex without blocking. If the mutex is currently held by another goroutine, it fails to acquire it and returns false.

            func (*Mutex) Unlock

            func (m *Mutex) Unlock()

              Unlock releases the mutex.

              Source Files