eventloop

package
v0.0.0-...-6f71180 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2015 License: Apache-2.0, CC-BY-SA-4.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChanLoop

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

ChanLoop is implementation of EventLoop based on channels.

func (*ChanLoop) Send

func (el *ChanLoop) Send(ev Event) error

Send sends event to channel. Will block if buffer is full.

func (*ChanLoop) Start

func (el *ChanLoop) Start() error

Start starting to read events from channel in separate goroutines. All calls after first is no-op.

type Event

type Event interface {
	Handle()
}

Event is receiving notification from loop with Handle() call.

type EventLoop

type EventLoop interface {
	Start() error
	Send(Event) error
}

EventLoop is interface for event loops. Start starting events processing Send adding event to loop

func NewChanLoop

func NewChanLoop(q int) EventLoop

NewChanLoop returns ChanLoop with internal channel buffer set to q.

Jump to

Keyboard shortcuts

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