mailbox

package
v0.0.0-...-199659d Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	Schedule(fn func())
	Throughput() int
}

func NewDispatcher

func NewDispatcher(throughput int) Dispatcher

type Invoker

type Invoker interface {
	//优先调用的命令消息
	ReceiveCmdMessage(message interface{})
	//普通传递的消息
	ReceiveUserMessage(message interface{})
}

type Mailbox

type Mailbox interface {
	PostUserMessage(message interface{})
	PostCmdMessage(message interface{})
}

The Mailbox interface is used to enqueue messages to the mailbox

func New

func New(size uint64, invoker Invoker, dispatcher Dispatcher) Mailbox

type Queue

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

func (*Queue) Pop

func (q *Queue) Pop() interface{}

Pop get interface{} from queue This call will easy blocked, if the queue is empty ,when multi goroutines

func (*Queue) Post

func (q *Queue) Post(item interface{})

Source Files

  • dispatcher.go
  • invoker.go
  • mailbox.go
  • queue.go

Jump to

Keyboard shortcuts

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