syncutil

package
v0.0.0-...-d94915d Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(fn func(context.Context, string, ...interface{}))

SetLogger changes the function which will be used by TimedMutex when warning about an above-threshold invocation.

Types

type Mutex

type Mutex struct {
	sync.Mutex
}

A Mutex is a mutual exclusion lock.

type RWMutex

type RWMutex struct {
	sync.RWMutex
}

An RWMutex is a reader/writer mutual exclusion lock.

type TimedMutex

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

TimedMutex is a mutex which dumps a stack trace whenever a lock is unlocked after being held for longer than the supplied duration, which must be strictly positive.

func MakeTimedMutex

func MakeTimedMutex(ctx context.Context, warnDuration time.Duration) TimedMutex

MakeTimedMutex creates a TimedMutex which warns when an Unlock happens more than warnDuration after the corresponding lock. It will use the supplied context for the warning message; see SetLogger().

func (*TimedMutex) Lock

func (tm *TimedMutex) Lock()

Lock implements sync.Locker

func (*TimedMutex) Unlock

func (tm *TimedMutex) Unlock()

Unlock implements sync.Locker

Jump to

Keyboard shortcuts

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