Commit e49ed758 authored by AlexStocks's avatar AlexStocks

Imp: set gr number by proc number instead of cpu number

parent 3ac9f982
...@@ -226,7 +226,7 @@ func (p *TaskPool) Close() { ...@@ -226,7 +226,7 @@ func (p *TaskPool) Close() {
// Task Pool Simple // Task Pool Simple
///////////////////////////////////////// /////////////////////////////////////////
type taskPoolSimple struct { type taskPoolSimple struct {
work chan task // task channel work chan task // task channel
sem chan struct{} // gr pool size sem chan struct{} // gr pool size
wg sync.WaitGroup wg sync.WaitGroup
...@@ -238,7 +238,7 @@ type taskPoolSimple struct { ...@@ -238,7 +238,7 @@ type taskPoolSimple struct {
// NewTaskPoolSimple build a simple task pool // NewTaskPoolSimple build a simple task pool
func NewTaskPoolSimple(size int) GenericTaskPool { func NewTaskPoolSimple(size int) GenericTaskPool {
if size < 1 { if size < 1 {
size = runtime.NumCPU() * 100 size = runtime.GOMAXPROCS(-1) * 100
} }
return &taskPoolSimple{ return &taskPoolSimple{
work: make(chan task), work: make(chan task),
......
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