Commit cc350d55 authored by watermelon's avatar watermelon

opt: opt comments for taskpool

parent e7888cff
......@@ -13,7 +13,7 @@ const (
// Task Pool Options
/////////////////////////////////////////
// TaskPoolOption is optional settings for task pool
// TaskPoolOptions is optional settings for task pool
type TaskPoolOptions struct {
tQLen int // task queue length. buffer size per queue
tQNumber int // task queue number. number of queue
......@@ -40,7 +40,7 @@ func (o *TaskPoolOptions) validate() {
type TaskPoolOption func(*TaskPoolOptions)
// WithTaskPoolTaskQueueLength set @size of the task queue pool size
// WithTaskPoolTaskPoolSize set @size of the task queue pool size
func WithTaskPoolTaskPoolSize(size int) TaskPoolOption {
return func(o *TaskPoolOptions) {
o.tQPoolSize = size
......
......@@ -43,7 +43,10 @@ type GenericTaskPool interface {
AddTaskAlways(t task)
// AddTaskBalance add task to idle queue
AddTaskBalance(t task)
// Close use to close the task pool
Close()
// IsClosed use to check pool status.
IsClosed() bool
}
func goSafely(fn func()) {
......@@ -278,4 +281,6 @@ func (p *taskPoolSimple) worker(t task) {
func (p *taskPoolSimple) Close() {}
func (p *taskPoolSimple) IsClosed() bool { return false }
func (p *taskPoolSimple) AddTaskBalance(t task) { p.AddTaskAlways(t) }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment