timedmutex

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimedMutex

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

TimedMutex is a blocking mutex which will unlock after a specified time

func NewTimedMutex

func NewTimedMutex(length time.Duration) *TimedMutex

NewTimedMutex creates a new timed mutex with a specified duration

func (*TimedMutex) LockForDuration

func (t *TimedMutex) LockForDuration()

LockForDuration will start a timer, lock the mutex, then allow the caller to continue After the duration, the mutex will be unlocked

func (*TimedMutex) UnlockIfLocked

func (t *TimedMutex) UnlockIfLocked() bool

UnlockIfLocked will unlock the mutex if its currently locked Will return true if successfully unlocked

Jump to

Keyboard shortcuts

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