spinlock

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 3 Imported by: 4

README

spinlock

GoDoc

A spinlock implementation for Go.

It shares the same interface as sync.Mutex, and is intended to be used to synchronize exceptionally short lived operations.

Install

go get -u github.com/tidwall/spinlock

Contact

Josh Baker @tidwall

License

SpinLock source code is available under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

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

Locker is a spinlock implementation.

A Locker must not be copied after first use.

func (*Locker) Lock

func (l *Locker) Lock()

Lock locks l. If the lock is already in use, the calling goroutine blocks until the locker is available.

func (*Locker) Unlock

func (l *Locker) Unlock()

Unlock unlocks l.

Jump to

Keyboard shortcuts

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