Documentation
¶
Overview ¶
Package kbuffthreadpool 协程池
说明 使用buff做任务队列的协程池 每个协程仅从自身任务队列中取任务,这样可以减少锁的争抢 每个任务可分配至最少任务的队列中,也可根据任务key值分配到相同的任务池,以此来保证任务的严格串行
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PoolHandlerIF ¶
PoolHandlerIF handler for upper apps
type PoolStatus ¶
type PoolStatus int
PoolStatus pool status
const ( // PoolStatusClosed closed PoolStatusClosed PoolStatus = 0 // PoolStatusInitialized initialized PoolStatusInitialized PoolStatus = 1 // PoolStatusStarting starting PoolStatusStarting PoolStatus = 2 // PoolStatusRunning running PoolStatusRunning PoolStatus = 3 // PoolStatusStopping stopping PoolStatusStopping PoolStatus = 4 )
type ThreadPool ¶
type ThreadPool struct {
// contains filtered or unexported fields
}
ThreadPool thread pool
func NewThreadPool ¶
func NewThreadPool(num uint, cb PoolHandlerIF) (*ThreadPool, error)
NewThreadPool new thread pool
func (*ThreadPool) AddTaskByKey ¶
func (tp *ThreadPool) AddTaskByKey(elem *Task) error
AddTaskByKey add task
func (*ThreadPool) AddTaskByMini ¶
func (tp *ThreadPool) AddTaskByMini(elem *Task) error
AddTaskByMini add task
Click to show internal directories.
Click to hide internal directories.