events

package
v0.0.0-...-a9ff0e8 Latest Latest
Warning

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

Go to latest
Published: May 13, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package events provides a single synchronization primitive - the Event. The event is used to notify that a condition has occurred to routines. Each event has two states - set and unset. Set state indicates the condition has occurred.

Multiple routines can wait on a condition. _All_ routines unblock once the event is set to the set state. A routine that waits on an event that is already set will not block.

The event primitive is similar to the event in the pSOS or ARINC 653 APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	//  Set changes the specified event to the set state. All the routines waiting
	//  on the event will stop waiting.  Any subsequent routine attempting to wait will not block until the
	//  event is set to the unset state again.
	//  Returns true if the event changed.
	Set() bool

	//  Resets the specified event to the unset state.   Once reset, any routine attempting to wait
	//  will block until the event is set again.  Returns true if the event changed.
	Reset() bool

	//  Checks if the specified event is in set state.
	IsSet() bool

	//  Wait for the event to be in the set state.  Any routine that attempts to wait on an event
	//  already in the set state will not block.
	Wait()

	//  Wait for the event to be in the set state up to the given timeout.  Any routine that attempts to wait
	//  on an event already in the set state will not block.
	TimedWait(timeout time.Duration) bool
}

Multiple routines can wait on a condition. _All_ routines unblock once the event is set to the set state. A routine that waits on an event that is already set will not block.

func MakeEvent

func MakeEvent() Event

Creates an event object for use by any routine. Upon creation the event is set to the unset state.

Jump to

Keyboard shortcuts

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