dispatcher

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ants

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

Ants 是使用 ants.Pool 作为分发器的实现,当 ants.Pool 无法使用时会退化为 goroutine 处理

func NewAnts

func NewAnts(size int, options ...ants.Option) (*Ants, error)

NewAnts 创建一个使用 ants.Pool 作为分发实现的实例

func (*Ants) Dispatch

func (a *Ants) Dispatch(f func())

type Dispatcher

type Dispatcher interface {
	Dispatch(f func())
}

Dispatcher 是用于分发邮箱消息的接口,不同的实现可以用于不同的场景

  • 通常分发器应该作为单例提供,当无法满足时应做出说明

func NewGoroutine

func NewGoroutine() Dispatcher

type Goroutine

type Goroutine int64

func (*Goroutine) Dispatch

func (g *Goroutine) Dispatch(f func())

Jump to

Keyboard shortcuts

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