tmutex

package
v0.0.0-...-ec91871 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL