service

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Work

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

TODO 这里的实现 chan如果塞满会阻塞进程,可对比参照github.com/davyxu/cellnet EventQueue实现,选方案

func (*Work) AfterPost

func (p *Work) AfterPost(d time.Duration, f func()) *time.Timer

func (*Work) Close

func (p *Work) Close()

func (*Work) Len

func (p *Work) Len() int

func (*Work) NewTicker

func (p *Work) NewTicker(d time.Duration, f func()) io.Closer

func (*Work) NewTryTicker

func (p *Work) NewTryTicker(d time.Duration, maxLen int, f func()) *time.Ticker

worker长度超过maxLen就丢弃f

func (*Work) Post

func (p *Work) Post(f func())

func (*Work) Run

func (p *Work) Run()

func (*Work) TryPost

func (p *Work) TryPost(f func(), maxLen int)

type Worker

type Worker interface {
	Post(f func())
	Run()
	Close()
	AfterPost(duration time.Duration, f func()) *time.Timer
	NewTicker(d time.Duration, f func()) io.Closer
	Len() int
}

func NewWorker

func NewWorker() Worker

Jump to

Keyboard shortcuts

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