Module event

Core events

Fundament event sources exposed by deai. This is the building blocks of other event sources.

See dbus, evdev, event, file, hwinfo, log, lua, misc, os, spawn, udev, xorg for more information about this type

Methods

any_promise(promises)

Wait for any of the given promises to resolve.

fdevent(fd, flag)

File descriptor events

join_promises(promises)

Wait for all given promises resolve.

new_promise()

Create a new promise object

periodic(interval, offset)

Periodic timer event

ready_promise(value)

Create a new promise that is already resolved

timer(timeout)

Timer events

any_promise(promises) Promise
Return type:

Promise

Parameters:

promises ([Promise])

Wait for any of the given promises to resolve.

Returns a promise that resolves when any of the given promises resolves. The returned promise will resolve with the value of the first promise that resolves.

fdevent(fd, flag) IoEv
Return type:

IoEv

Parameters:
  • fd (integer)

  • flag (integer) – bit mask of which events to monitor. bit 0 for readability, bit 1 for writability.

File descriptor events

Wait for a file descriptor to be readable/writable.

join_promises(promises) Promise
Return type:

Promise

Parameters:

promises ([Promise])

Wait for all given promises resolve.

Returns a promises that resolves into an array, which stores the results of the promises. The promises can resolve in any order.

new_promise() Promise
Return type:

Promise

Create a new promise object

periodic(interval, offset) Periodic
Return type:

Periodic

Parameters:
  • interval (float)

  • offset (float)

Periodic timer event

A timer that first fire after offset seconds, then every interval seconds.

ready_promise(value) Promise
Return type:

Promise

Parameters:

value (any) – what the returned promise will resolve to

Create a new promise that is already resolved

timer(timeout) Timer
Return type:

Timer

Parameters:

timeout (float) – timeout in seconds

Timer events

Create a timer that emits a signal after timeout is reached. Note that signals will only be emitted if listeners exist. If no listeners existed during the timeout window, the singal will be emitted when the first listener is attached.