sync

package
v0.0.0-...-1a7aca4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package sync provides synchronization primitive implementations for spinlocks and semaphore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Spinlock

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

Spinlock implements a lock where each task trying to acquire it busy-waits till the lock becomes available.

func (*Spinlock) Acquire

func (l *Spinlock) Acquire()

Acquire blocks until the lock can be acquired by the currently active task. Any attempt to re-acquire a lock already held by the current task will cause a deadlock.

func (*Spinlock) Release

func (l *Spinlock) Release()

Release relinquishes a held lock allowing other tasks to acquire it. Calling Release while the lock is free has no effect.

func (*Spinlock) TryToAcquire

func (l *Spinlock) TryToAcquire() bool

TryToAcquire attempts to acquire the lock and returns true if the lock could be acquired or false otherwise.

Jump to

Keyboard shortcuts

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