Skip to content

Latest commit

 

History

History
96 lines (46 loc) · 1.74 KB

semaphore.md

File metadata and controls

96 lines (46 loc) · 1.74 KB

semaphore

import "github.com/andy2046/gopie/pkg/semaphore"

Package semaphore provides a semaphore implementation.

semaphore.go

type ISemaphore interface {
    Acquire(context.Context) error
    Release(context.Context) error
}

ISemaphore is the semaphore interface.

func New(n int) ISemaphore

New creates a new semaphore with given maximum concurrent access.

type Semaphore struct {
    // contains filtered or unexported fields
}

Semaphore is the semaphore implementation.

func (*Semaphore) Acquire

func (s *Semaphore) Acquire(ctx context.Context) error

Acquire acquires the semaphore.

func (*Semaphore) Release

func (s *Semaphore) Release(ctx context.Context) error

Release releases the semaphore.


Generated by godoc2md