event.watcher - Palamecia/mint GitHub Wiki

Module

load event.watcher

This module provides the Event.Watcher class which is the main class of the Event package.

Packages

Classes

Event.Watcher

This class is the main class of the Event package. It provides mechanismes to schedule multiple events.

An instance of Event.Watcher schedule a set of events. Severals instances of the class can be created to manage distinct sets.

The scheduled event objects must provide a getHandle method that return an instance of handle created by the C++ function mint::create_handle.

Members

Modifiers Member Description
- class PollDescriptor Internal poll context structure.
- final events Internal set of watched event objects.
- @ g_lib Global library handle.
+ const new Creates a new watcher. The created watcher is empty.
+ const poll Waits until at least one of the watched events is set. If timeout is given,...
+ const remove Removes the event from the watcher. Returns true if event is watched by...
+ const watch Adds an event to the watcher. The event object must provides the getHan...

Event.Watcher.PollDescriptor

Internal poll context structure.

Members

Modifiers Member Description
+ activated Activation state.
+ event Event object.
+ handle Event handle.
+ const new Creates a new context for the given event object.

Descriptions

Event.Watcher.PollDescriptor.activated

false

Activation state.

Event.Watcher.PollDescriptor.event

none

Event object.

Event.Watcher.PollDescriptor.handle

none

Event handle.

Event.Watcher.PollDescriptor.new

def (self, event)

Creates a new context for the given event object.

Event.Watcher.events

null

Internal set of watched event objects.

Event.Watcher.g_lib

lib ('libmint-event')

Global library handle.

Event.Watcher.new

def (self)

Creates a new watcher. The created watcher is empty.

Event.Watcher.poll

def (self, timeout = none)

Waits until at least one of the watched events is set. If timeout is given, the wait stop after timeout milliseconds if no event is set.

Returns an iterator on each setted events. If no event is set, the iterator has no element.

After a call to this method, the events must be manually reseted. The reset method of the event can be called to ignore the event.

Event.Watcher.remove

def (self, event)

Removes the event from the watcher. Returns true if event is watched by the watcher; otherwise returns false.

Event.Watcher.watch

def (self, event)

Adds an event to the watcher. The event object must provides the getHandle method.