forked from mirror/ants
gofmt
This commit is contained in:
parent
a008afdc73
commit
47e2b9efaa
|
@ -20,10 +20,10 @@
|
|||
package ants_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/panjf2000/ants"
|
||||
"sync"
|
||||
"runtime"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
16
pool.go
16
pool.go
|
@ -19,9 +19,9 @@
|
|||
package ants
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
"sync"
|
||||
"math"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -33,27 +33,27 @@ type f func()
|
|||
// of goroutines to a given number by recycling goroutines.
|
||||
type Pool struct {
|
||||
// Capacity of the pool.
|
||||
capacity int32
|
||||
capacity int32
|
||||
|
||||
// The number of the currently running goroutines.
|
||||
running int32
|
||||
running int32
|
||||
|
||||
// Signal is used to notice pool there are available
|
||||
// workers which can be sent to work.
|
||||
freeSignal chan sig
|
||||
|
||||
// A slice that store the available workers.
|
||||
workers []*Worker
|
||||
workers []*Worker
|
||||
|
||||
workerPool sync.Pool
|
||||
|
||||
// It is used to notice the pool to closed itself.
|
||||
release chan sig
|
||||
release chan sig
|
||||
|
||||
lock sync.Mutex
|
||||
lock sync.Mutex
|
||||
|
||||
// It is used to confirm whether this pool has been closed.
|
||||
closed int32
|
||||
closed int32
|
||||
}
|
||||
|
||||
func NewPool(size int) (*Pool, error) {
|
||||
|
|
Loading…
Reference in New Issue