system.poller - Palamecia/mint GitHub Wiki
Module system.poller
Description
load system.poller
This module provides the System.Poller class which allows to wait for multiple events at the same time.
Packages
Classes
System.Poller
This class provides mechanisms to wait for multiple events.
An instance of System.Poller watch a set of events. Severals instances of the class can be created to manage distinct sets.
The watched event objects must provide a getHandle method that return an instance of mint::handle_t.
Public members
| Modifiers | Member | Description |
|---|---|---|
const |
new | Creates a new poller object. |
const |
poll | Waits until at least one of the watched events is set. If timeout is given, t... |
const |
run | Runs a polling loop that calls System.Poller.poll until no more event is watc... |
const |
unwatch | Removes the object from the watcher. Returns true if event is watched by the ... |
const |
watch | Adds an object to the watcher. The object object must provides a getPollEvent... |
Package members
| Modifiers | Member | Description |
|---|---|---|
@ const |
eventFromObject | Returns the event handle from the given object. The object must provide a get... |
Private members
| Modifiers | Member | Description |
|---|---|---|
class |
PollDescriptor | Internal poll context structure. |
final |
d_ptr | Object data. |
final |
events | Internal set of watched event objects. |
@ const |
g_lib | Global library handle. |
System.Poller.PollDescriptor
Internal poll context structure.
Public members
| Modifiers | Member | Description |
|---|---|---|
| callback | Callback to call when the event is triggered. | |
| event | Event handle. | |
const |
new | Creates a new context for the given event object. |
| object | Event object. |
Descriptions
System.Poller.PollDescriptor.callback
none
Callback to call when the event is triggered.
System.Poller.PollDescriptor.event
null
Event handle.
System.Poller.PollDescriptor.new
def (self, object)
Creates a new context for the given event object.
System.Poller.PollDescriptor.object
null
Event object.
System.Poller.d_ptr
null
Object data.
System.Poller.eventFromObject
def (object)
Returns the event handle from the given object. The object must provide a getHandle method. If the object
provides a getPollEvent method, it is called to get the event handle.
System.Poller.events
{}
Internal set of watched event objects.
System.Poller.g_lib
lib ('libmint-system')
Global library handle.
System.Poller.new
def (self)
Creates a new poller object.
System.Poller.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. The callback of each set event is called.
Returns true if at least one event is set; otherwise returns false.
An instance of Exception.SystemError is raised on error.
System.Poller.run
def (self, timeout = 500)
Runs a polling loop that calls poll until no more event is watched. The timeout parameter is
forwarded to the called method.
System.Poller.unwatch
def (self, object)
Removes the object from the watcher. Returns true if event is watched by the watcher; otherwise returns
false.
An instance of Exception.SystemError is raised on error.
System.Poller.watch
def (self, object, callback)
Adds an object to the watcher. The object object must provides a getPollEvent or getHandle method.
When the event associated to object is triggered, callback will ba called by poll. Returns true
if object is successfully watched; otherwise returns false.
An instance of Exception.SystemError is raised on error.