event.timer - Palamecia/mint GitHub Wiki

Module

load event.timer

This module provides the Event.Timer class which provides a waitable timer implementation.

Packages

Enums

Event.Timer.ClockType

This enum describe the clock precision.

Constant Value Description
Monotonic 0

Classes

Event.Timer

This class provides a waitable timer implementation that trigger an event when the timer timeout.

The timer's clock can be adjusted by using a value of the Event.Timer.ClockType enum.

This type is not copyable

Members

Modifiers Member Description
+ enum ClockType This enum describe the clock precision.
+ const clear Resets the timout event.
- const clone Disable object copy.
+ const delete Cleans up the timer instance.
- final duration Internal timer duration.
+ final eventHandle Internal handle.
- @ g_lib Global library handle.
+ const getHandle Returns the handle used by Event.Watcher.
+ const isRunning Returns true if the timer is running; otherwise returns false.
+ const new Creates a new timer. The created timer is not started. The clockType can be...
+ const reset Reset the internal event state
+ const restart Restarts the timer with the same timeout duration than the previous call to s...
+ const start Starts or restarts the timer with a timeout of duration duration millisecon...
+ const stop Stops the timer.
+ const wait Waits until the timer timeout. If timeout is given, the wait stop after t...

Descriptions

Event.Timer.ClockType.Monotonic

0

Event.Timer.clear

def (self)

Resets the timout event.

Event.Timer.clone

none

Disable object copy.

Event.Timer.delete

def (self)

Cleans up the timer instance.

Event.Timer.duration

none

Internal timer duration.

Event.Timer.eventHandle

none

Internal handle.

Event.Timer.g_lib

lib ('libmint-event')

Global library handle.

Event.Timer.getHandle

def (const self)

Returns the handle used by Event.Watcher.

Event.Timer.isRunning

def (const self)

Returns true if the timer is running; otherwise returns false.

Event.Timer.new

def (self, clockType = Event.Timer.ClockType.Monotonic)

Creates a new timer. The created timer is not started.

The clockType can be a value of Event.Timer.ClockType that describe the timer's clock precision.

If no timer can be created, none is returned.

Event.Timer.reset

def (self)

Reset the internal event state

Event.Timer.restart

def (self)

Restarts the timer with the same timeout duration than the previous call to start. The timeout event is reseted.

Returns true if a previous timeout duration can be found; otherwise false is returned and the timer is not started.

Event.Timer.start

def (self, duration)

Starts or restarts the timer with a timeout of duration duration milliseconds.

Event.Timer.stop

def (self)

Stops the timer.

Event.Timer.wait

def (self, timeout = none)

Waits until the timer timeout. If timeout is given, the wait stop after timeout milliseconds if the timer has still not timed out.

Returns true if the timer timed out; otherwise returns false if the wait timed out.

After a call to this method, the event is reseted.