golockercheckable

package module
v0.0.0-...-9827934 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: GPL-3.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockerCheckable

type LockerCheckable interface {
	sync_o.Locker
	IsLocked() bool
	IsLocakedByMe() (locked bool, byme bool)
	LocekdByWho() (locked bool, goid uint64)
}

type MutexCheckable

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

Difference to sync.Mutex, is what Unlock can be called if already unlocked. This can be used in sync.Cond without afraiding to get error when Unlock() called. NewMutexCheckable() must be used to create object of this struct.

func NewMutexCheckable

func NewMutexCheckable(locked bool) *MutexCheckable

set locked to true, to make resulting Mutex already locked on creation

func (*MutexCheckable) IsLocakedByMe

func (self *MutexCheckable) IsLocakedByMe() (locked bool, byme bool)

func (*MutexCheckable) IsLocked

func (self *MutexCheckable) IsLocked() bool

returns lock state

func (*MutexCheckable) LocekdByWho

func (self *MutexCheckable) LocekdByWho() (locked bool, goid uint64)

func (*MutexCheckable) Lock

func (self *MutexCheckable) Lock()

same as sync.Lock()

func (*MutexCheckable) Unlock

func (self *MutexCheckable) Unlock()

same as sync.Unlock(), except, doesn't results in error when called on unlocked MutexCheckable

Jump to

Keyboard shortcuts

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