Skip to content

Commit

Permalink
添加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
lixizan committed Dec 13, 2022
1 parent 847ce3b commit fc372aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions worker_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
)

type WorkerGroup struct {
mu *sync.Mutex
err error
config *Config
done chan bool
q []Job
taskDone int64
taskTotal int64
OnError func(err error)
mu *sync.Mutex // 锁
err error // 错误
config *Config // 配置
done chan bool // 信号
q []Job // 任务队列
taskDone int64 // 已完成任务数量
taskTotal int64 // 总任务数量
OnError func(err error) // 错误处理函数. 一般用来打印错误; 放弃剩余任务
}

// NewWorkerGroup 新建一个任务集
Expand Down
12 changes: 6 additions & 6 deletions worker_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
)

type WorkerQueue struct {
mu *sync.Mutex
config *Config
q []Job
maxConcurrency int64
curConcurrency int64
OnError func(err error)
mu *sync.Mutex // 锁
config *Config // 配置
q []Job // 任务队列
maxConcurrency int64 // 最大并发
curConcurrency int64 // 当前并发
OnError func(err error) // 错误处理函数. 一般用来打印错误;
}

// NewWorkerQueue 创建一个工作队列
Expand Down

0 comments on commit fc372aa

Please sign in to comment.