gotask

package
v1.2.24053 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: BSD-3-Clause Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPatrolTask

func AddPatrolTask(id interface{}, minInterval time.Duration, fn patrolcb, args ...interface{})

Types

type PatrolTask

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

func DefaultPatrolTask

func DefaultPatrolTask() *PatrolTask

func NewPatrolTask

func NewPatrolTask() *PatrolTask

func (*PatrolTask) AddTask

func (this *PatrolTask) AddTask(id interface{}, minInterval time.Duration, fn patrolcb, args ...interface{}) error

func (*PatrolTask) AddTaskOnce

func (this *PatrolTask) AddTaskOnce(id interface{}, fn patrolcb, args ...interface{}) error

func (*PatrolTask) AddTaskOnceA1

func (this *PatrolTask) AddTaskOnceA1(arg interface{}, fn func(arg interface{})) error

func (*PatrolTask) CheckAbnormal

func (this *PatrolTask) CheckAbnormal() error

func (*PatrolTask) CheckStart

func (this *PatrolTask) CheckStart()

func (*PatrolTask) DelTask

func (this *PatrolTask) DelTask(id interface{}) error

func (*PatrolTask) Status

func (this *PatrolTask) Status() string

type RunableProc

type RunableProc func(worker *TaskWorker, args ...interface{})

type TaskPool

type TaskPool struct {
	TaskPush int64
	TaskPop  int64

	WorkMin    int32 //
	WorkMax    int32 //
	BusyCnt    int32 // 正在目录的线程
	Terminated int32
	// contains filtered or unexported fields
}

func NewTaskPool

func NewTaskPool(maxCache int) *TaskPool

func (*TaskPool) Close

func (this *TaskPool) Close()

func (*TaskPool) GetTaskNum

func (this *TaskPool) GetTaskNum() int

func (*TaskPool) IsTerminated

func (this *TaskPool) IsTerminated() bool

func (*TaskPool) PostTask

func (this *TaskPool) PostTask(fn RunableProc, args ...interface{}) bool

func (*TaskPool) RunMinWorkers

func (this *TaskPool) RunMinWorkers()

func (*TaskPool) Status

func (this *TaskPool) Status() string

func (*TaskPool) WorkNum

func (this *TaskPool) WorkNum() int

type TaskWorker

type TaskWorker struct {
	GoID  uint64
	Owner *TaskPool
	Fixed int8
}

func (*TaskWorker) Run

func (this *TaskWorker) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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