Documentation
¶
Overview ¶
Package syncx 提供上下文感知并发限制和工作组。
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SemaphoreLimiter ¶
type SemaphoreLimiter struct {
// contains filtered or unexported fields
}
func NewSemaphoreLimiter ¶
func NewSemaphoreLimiter(n int) *SemaphoreLimiter
Example ¶
package main
import (
"context"
"github.com/ZoneCNH/kernel/syncx"
)
func main() {
limiter := syncx.NewSemaphoreLimiter(2)
_ = limiter.Acquire(context.Background())
limiter.Release()
}
Output:
func (*SemaphoreLimiter) Release ¶
func (l *SemaphoreLimiter) Release()
type WorkerGroup ¶
type WorkerGroup struct {
// contains filtered or unexported fields
}
func NewWorkerGroup ¶
func NewWorkerGroup(ctx context.Context) *WorkerGroup
func (*WorkerGroup) Wait ¶
func (g *WorkerGroup) Wait() error
Click to show internal directories.
Click to hide internal directories.