timedmutex

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 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