mutex

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package mutex provides switch of concurrent safe feature for sync.Mutex.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

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

Mutex is a sync.Mutex with a switch for concurrent safe feature.

func New

func New(safe ...bool) *Mutex

New creates and returns a new *Mutex. The parameter `safe` is used to specify whether using this mutex in concurrent-safety, which is false in default.

func (*Mutex) IsSafe

func (mu *Mutex) IsSafe() bool

func (*Mutex) Lock

func (mu *Mutex) Lock()

func (*Mutex) Unlock

func (mu *Mutex) Unlock()

Jump to

Keyboard shortcuts

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