grouptask

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckInitialDefaultWorkers

func CheckInitialDefaultWorkers(minwork, maxwork int32, quemax int32) bool

Types

type GroupTask

type GroupTask struct {
	Id string

	FixedWorker byte

	OnFatalCallBack func(sender *GroupTask, rec *groupTaskRec, err error)
	// contains filtered or unexported fields
}

func DefaultGroupTask

func DefaultGroupTask() *GroupTask

func NewGroupTask

func NewGroupTask() *GroupTask

func (*GroupTask) CheckAbnormal

func (this *GroupTask) CheckAbnormal() (err error)

func (*GroupTask) CheckCreateFixedGroupChannel

func (this *GroupTask) CheckCreateFixedGroupChannel(groupid interface{}) *groupTaskChannel

func (*GroupTask) ConfigChannelMaxQueueSize

func (this *GroupTask) ConfigChannelMaxQueueSize(queue_size int32) *GroupTask

func (*GroupTask) ConfigChannelMaxWorkNum

func (this *GroupTask) ConfigChannelMaxWorkNum(groupid interface{}, maxWorkNum int32) *GroupTask

设置通道的最大工作纤程数量

  1. 如果设置成大于1或者0, 会有多线程同时执行通道内任务

func (*GroupTask) ConfigGrowIfTaskPiled

func (this *GroupTask) ConfigGrowIfTaskPiled(num int32) *GroupTask

func (*GroupTask) ConfigMaxWork

func (this *GroupTask) ConfigMaxWork(num int32) *GroupTask

func (*GroupTask) ConfigMinWork

func (this *GroupTask) ConfigMinWork(num int32) *GroupTask

func (*GroupTask) ConfigPostTimeout added in v1.2.24041

func (this *GroupTask) ConfigPostTimeout(v time.Duration)

func (*GroupTask) Details

func (this *GroupTask) Details(all bool) string

func (*GroupTask) DetailsEx

func (this *GroupTask) DetailsEx(all bool, max int) string

func (*GroupTask) DetailsEx2

func (this *GroupTask) DetailsEx2(all bool, max int, searchval, exclusive string) string

func (*GroupTask) GetChannelMaxQueueSize

func (this *GroupTask) GetChannelMaxQueueSize() int32

func (*GroupTask) GroupSimpleStatus

func (this *GroupTask) GroupSimpleStatus(groupid interface{}) string

func (*GroupTask) GroupStatus

func (this *GroupTask) GroupStatus(groupid interface{}) string

func (*GroupTask) IsTerminated

func (this *GroupTask) IsTerminated() bool

func (*GroupTask) PostChannelTaskFunc

func (this *GroupTask) PostChannelTaskFunc(groupChanel interface{}, cb func(args ...interface{}), args ...interface{}) error

需要调用者确保groupChannel可用 没有被移除掉

func (*GroupTask) PostTaskArgs

func (this *GroupTask) PostTaskArgs(groupid interface{}, cb func(sender *groupTaskRec), args ...interface{}) error

func (*GroupTask) PostTaskArgsEx

func (this *GroupTask) PostTaskArgsEx(groupid interface{}, cb func(args ...interface{}), args ...interface{}) error

func (*GroupTask) PostTaskFunc

func (this *GroupTask) PostTaskFunc(groupid interface{}, cb func()) error

func (*GroupTask) PostTaskFuncAndWait

func (this *GroupTask) PostTaskFuncAndWait(groupid interface{}, timeout time.Duration, cb func()) (ok bool, err error)

参数:

timeout:表示等待执行的时间, 如果到时尚未执行, 则函数不会再执行, 如果到超时时间已经在执行,则会等待执行完成

返回:

ok: true: 表示执行成功, false:执行超时
err: 投递任务失败, wait timeout

func (*GroupTask) PostTaskFuncArgs

func (this *GroupTask) PostTaskFuncArgs(groupid interface{}, cb func(args ...interface{}), args ...interface{}) error

**

  • 可以用做同步执行

func (*GroupTask) RemoveFixedGroupChannel

func (this *GroupTask) RemoveFixedGroupChannel(groupid interface{}) bool

func (*GroupTask) Start

func (this *GroupTask) Start()

*

  • 可以重复执行g

func (*GroupTask) StatusSimpleString

func (this *GroupTask) StatusSimpleString() string

func (*GroupTask) StatusString

func (this *GroupTask) StatusString() string

func (*GroupTask) Stop

func (this *GroupTask) Stop()

func (*GroupTask) TaskCnt

func (this *GroupTask) TaskCnt() int32

func (*GroupTask) Terminate

func (this *GroupTask) Terminate()

func (*GroupTask) WaitExecFunc

func (this *GroupTask) WaitExecFunc(sender *groupTaskRec)

Jump to

Keyboard shortcuts

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