Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSemaphoreReleasedTooManyTimes = errors.New("Semaphore released too many times")
ErrSemaphoreReleasedTooManyTimes is the ValueError of an over released BoundedSemaphore
Functions ¶
func GoroutineID ¶
func GoroutineID() uint64
Identifier of the calling goroutine, the Go form of threading.get_ident
Types ¶
type BoundedSemaphore ¶
type BoundedSemaphore struct {
// contains filtered or unexported fields
}
BoundedSemaphore is threading.BoundedSemaphore, a counter that refuses release past its initial value
func NewBoundedSemaphore ¶
func NewBoundedSemaphore(value int) *BoundedSemaphore
Semaphore holding value free slots
func (*BoundedSemaphore) Acquire ¶
func (s *BoundedSemaphore) Acquire(blocking bool) bool
Takes a slot, without blocking false when none is free
func (*BoundedSemaphore) Release ¶
func (s *BoundedSemaphore) Release() error
Returns a slot, the ValueError when every slot is already free
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event is threading.Event, a flag goroutines set once and wait on
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Per goroutine value slot, the threading.local form keyed by the calling goroutine
func (*Local) Delete ¶
func (l *Local) Delete()
Forgets the calling goroutine's value so a finished goroutine leaves nothing behind
type RLock ¶
type RLock struct {
// contains filtered or unexported fields
}
RLock is threading.RLock, reacquirable by the goroutine that holds it and released after as many unlocks
func (*RLock) Lock ¶
func (l *RLock) Lock()
Blocks until the lock is free or already held by this goroutine, then bumps the hold count
func (*RLock) TryLockFor ¶
Acquires like Lock but gives up once timeout passes, the acquire(timeout=...) form