Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Semaphore ¶
type Semaphore interface { // Acquire blocks until num resource counts have been obtained Acquire(num int) // TryAcquire attempts to obtain num resource counts without blocking TryAcquire(num int) bool // Release causes num resource counts to be released Release(num int) }
Semaphore is the interface for the several types of semaphore implemented by Amass.
func NewSimpleSemaphore ¶
NewSimpleSemaphore returns a SimpleSemaphore initialized to max resource counts.
type SimpleSemaphore ¶
type SimpleSemaphore struct {
// contains filtered or unexported fields
}
SimpleSemaphore implements a synchronization object type capable of being a counting semaphore.
func (*SimpleSemaphore) Acquire ¶
func (s *SimpleSemaphore) Acquire(num int)
Acquire blocks until num resource counts have been obtained.
func (*SimpleSemaphore) Release ¶
func (s *SimpleSemaphore) Release(num int)
Release causes num resource counts to be released.
func (*SimpleSemaphore) TryAcquire ¶
func (s *SimpleSemaphore) TryAcquire(num int) bool
TryAcquire attempts to obtain num resource counts without blocking. The method returns true when successful in acquiring the resource counts.
type TimedSemaphore ¶
type TimedSemaphore struct {
// contains filtered or unexported fields
}
TimedSemaphore implements a synchronization object type capable of being a counting semaphore.
func (*TimedSemaphore) Acquire ¶
func (t *TimedSemaphore) Acquire(num int)
Acquire blocks until num resource counts have been obtained.
func (*TimedSemaphore) Release ¶
func (t *TimedSemaphore) Release(num int)
Release causes num resource counts to be released.
func (*TimedSemaphore) TryAcquire ¶
func (t *TimedSemaphore) TryAcquire(num int) bool
TryAcquire attempts to obtain num resource counts without blocking. The method returns true when successful in acquiring the resource counts.