netstack: github.com/google/netstack/tmutex Index | Files

package tmutex

import "github.com/google/netstack/tmutex"

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

Index

Package Files

tmutex.go

type Mutex Uses

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 Uses

func (m *Mutex) Init()

Init initializes the mutex.

func (*Mutex) Lock Uses

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 Uses

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 Uses

func (m *Mutex) Unlock()

Unlock releases the mutex.

Package tmutex imports 1 packages (graph) and is imported by 1 packages. Updated 2018-11-15. Refresh now. Tools for package owners.