Documentation
¶
Overview ¶
Package semaphore provives semaphore.
Index ¶
- type Semaphore
- func (s *Semaphore) Capacity() int
- func (s *Semaphore) Do(ctx context.Context, f func(ctx context.Context) error) (err error)
- func (s *Semaphore) Name() string
- func (s *Semaphore) NumRequests() int
- func (s *Semaphore) NumServs() int
- func (s *Semaphore) NumWaits() int
- func (s *Semaphore) TryAcquire(ctx context.Context) (context.Context, func(error), error)
- func (s *Semaphore) WaitAcquire(ctx context.Context) (context.Context, func(error), error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Semaphore ¶
type Semaphore struct {
// contains filtered or unexported fields
}
Semaphore is a semaphore.
func (*Semaphore) NumRequests ¶
NumRequests returns total number of requests.
func (*Semaphore) TryAcquire ¶
TryAcquire acquires a semaphore if available, or return error. It returns a context for acquired semaphore and func to release it.
Click to show internal directories.
Click to hide internal directories.