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 ¶
TryToAcquire attempts to acquire the lock and returns true if the lock could be acquired or false otherwise.
Click to show internal directories.
Click to hide internal directories.