Documentation
¶
Index ¶
- type Await
- func (at *Await[T]) Close(idx int64) (err error)
- func (at *Await[T]) CloseAndPut(idx int64, v T) (err error)
- func (at *Await[T]) Get(idx int64) (ch chan T)
- func (at *Await[T]) Has(idx int64) bool
- func (at *Await[T]) SyncWait(wg *sync.WaitGroup, idx int64, timeout time.Duration) (r T, err error)
- func (at *Await[T]) Wait(idx int64, timeout time.Duration) (r T, err error)
- func (at *Await[T]) WaitWithCancel(ctx context.Context, idx int64, timeout time.Duration) (r T, isCancel bool, err error)
- type FastAwait
- func (fa *FastAwait[T]) Close(syncId int64) (err error)
- func (fa *FastAwait[T]) CloseAndPut(syncId int64, v T) (err error)
- func (fa *FastAwait[T]) Wait(syncId int64, timeout time.Duration) (r T, err error)
- func (fa *FastAwait[T]) WaitWithCancel(ctx context.Context, syncId int64, timeout time.Duration) (r T, cancel bool, err error)
- type LimitLock
- type Numlock
- type Strlock
- func (sl *Strlock) Lock(key string) *sync.RWMutex
- func (sl *Strlock) RLock(key string) *sync.RWMutex
- func (sl *Strlock) RUnlock(key string)
- func (sl *Strlock) TryLock(key string) (*sync.RWMutex, bool)
- func (sl *Strlock) TryRLock(key string) (*sync.RWMutex, bool)
- func (sl *Strlock) Unlock(key string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Await ¶
type Await[T any] struct { // contains filtered or unexported fields }
Await is a generic wait group implementation that allows setting channels for different keys.
func (*Await[T]) Close ¶ added in v0.1.9
Close deletes and closes the channel associated with the given index.
func (*Await[T]) CloseAndPut ¶ added in v0.1.9
CloseAndPut sends a value to the channel and deletes it from the map.
func (*Await[T]) SyncWait ¶ added in v0.2.0
SyncWait wait for the channel data to return or close, and set the timeout period
type FastAwait ¶ added in v0.2.0
type FastAwait[T any] struct { // contains filtered or unexported fields }
func NewFastAwait ¶ added in v0.2.0
func NewFastAwait2 ¶ added in v0.2.0
func (*FastAwait[T]) CloseAndPut ¶ added in v0.2.0
type LimitLock ¶
type LimitLock struct {
// contains filtered or unexported fields
}
LimitLock limits the number of concurrent operations and can enforce timeouts.
func NewLimitLock ¶
NewLimitLock initializes and returns a new LimitLock instance.
type Numlock ¶
type Numlock struct {
// contains filtered or unexported fields
}
Numlock provides a set of mutex locks based on integer keys.
func NewNumLock ¶
NewNumLock initializes and returns a new Numlock instance.
type Strlock ¶
type Strlock struct {
// contains filtered or unexported fields
}
Strlock provides a set of read-write mutex locks based on string keys.
func NewStrlock ¶
NewStrlock initializes and returns a new Strlock instance.
func (*Strlock) TryLock ¶ added in v0.2.1
TryLock try to acquire the write lock associated with the given key.