spinlock

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package spinlock implements Spinlock.

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 the Spinlock implementation.

func New

func New() *Locker

New creates a Locker.

func (*Locker) IsLocked added in v0.7.0

func (l *Locker) IsLocked() bool

IsLocked returns true if locked, false otherwise.

func (*Locker) Lock

func (l *Locker) Lock()

Lock wait in a loop to acquire the spinlock.

func (*Locker) TryLock added in v0.7.0

func (l *Locker) TryLock() bool

TryLock try to acquire the spinlock, it returns true if succeed, false otherwise.

func (*Locker) Unlock

func (l *Locker) Unlock()

Unlock release the spinlock.

Jump to

Keyboard shortcuts

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