ypool

package module
v0.0.0-...-68519ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2019 License: MIT Imports: 1 Imported by: 0

README

ypool

go routine pool with priority and queue

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskPriority

type TaskPriority int

task priority type with level: None=0,Normal=1,High=2,Emergent=3

const (
	//the lowest priority level,use for logging and no time requirement task
	None TaskPriority = iota
	//the normal priority for common use
	Normal
	//for high level use
	High
	//the highest priority
	Emergent
)

type Ypool

type Ypool struct {
	// contains filtered or unexported fields
}

the pool manager

func (*Ypool) GetPoolMaxSize

func (this *Ypool) GetPoolMaxSize() uint32

get pool max size

func (*Ypool) SetPoolMaxSize

func (this *Ypool) SetPoolMaxSize(newPoolMaxSize uint32) uint32

adjust pool max size min size is 4, return old pool max size

func (*Ypool) Submit

func (this *Ypool) Submit(task func()) error

submit a task in pool, equal to SubmitPriority(Normal,task)

func (*Ypool) SubmitPriority

func (this *Ypool) SubmitPriority(priority TaskPriority, task func()) error

submit a task with priority

func (*Ypool) SubmitQueue

func (this *Ypool) SubmitQueue(queueName interface{}, task func()) error

submit a task to pool in queue with name:queueName, equal to SubmitQueuePriority(Normal,queueName,task)

func (*Ypool) SubmitQueuePriority

func (this *Ypool) SubmitQueuePriority(priority TaskPriority, queueName interface{}, task func()) error

submit a task to pool in queue with priority and queueName

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL