Documentation
¶
Index ¶
Constants ¶
View Source
const ( // pool state PoolOpen = iota PoolClose )
Variables ¶
View Source
var ( // ErrorPoolArriveCapacity would be return if submit a task to a pool who does not has more capacity to run a new goroutine. ErrorPoolArriveCapacity = errors.New("error cause of the pool is running to many goroutine") // ErrorPoolClosed would be return if submit a task to a closed pool. ErrorPoolClosed = errors.New("error cause of the pool is closed") )
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool interface {
// RunTask submit a user-task to a goroutine,
// and would return an error when creating a goWorker failed
RunTask(func()) error
// RunTaskWithRet submit a user-task which has a return value,
// and would return a closed-chan that func`s result Value would be pushed in,
// or a nil-chan if some error happend while creating a goWorker.
RunTaskWithRet(func() interface{}) (<-chan interface{}, error)
// Close Stop the pool and close all goroutines.
Close()
// IsClosed return whether the pool has been closed.
IsClosed() bool
// RunningCount return workers count which are running.
RunningCount() int32
}
Click to show internal directories.
Click to hide internal directories.