Documentation
¶
Overview ¶
Package syncprim provides Semaphore and Once built on fenced claim primitives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotHeld = errors.New("syncprim: not held") )
Functions ¶
This section is empty.
Types ¶
type FencedClaims ¶
type FencedClaims interface {
Acquire(ctx context.Context, claim string) (token uint64, err error)
Release(ctx context.Context, claim string, token uint64) error
}
FencedClaims acquires named claims with fencing tokens.
type Once ¶
type Once struct {
// contains filtered or unexported fields
}
Once ensures a single fenced execution of fn across participants.
type Semaphore ¶
type Semaphore struct {
// contains filtered or unexported fields
}
Semaphore bounds concurrent holders using one claim name per permit slot.
func NewSemaphore ¶
func NewSemaphore(claims FencedClaims, namePrefix string, n int) (*Semaphore, error)
NewSemaphore creates a semaphore with n permits (n > 0, bounded).
Click to show internal directories.
Click to hide internal directories.