Namespace l2dbus.Dispatcher

The L2DBUS Event Dispatcher Object

This namespace provides a constructor and methods for manipulating the D-Bus event Dispatcher object.

A Dispatcher is responsible for running the event loop that detects incoming D-Bus messages and timeouts and also dispatches outgoing messages and signals.

Functions

new (Main)

Constants

DISPATCH_WAIT
DISPATCH_NO_WAIT
DISPATCH_ONCE

Dispatcher

run (disp, runOpt)
stop (disp)


Functions

new (Main)

Creates a new L2DBUS Dispatcher.

Constructs a new Dispatcher using the provided main loop.

Parameters:

  • Main userdata loop to be used by the dispatcher.

Returns:

    userdata Dispatcher userdata object

Constants

DISPATCH_WAIT
Calls to run with this option block waiting for successive events until stop is called on the Dispatcher.
DISPATCH_NO_WAIT
Calls to run with this option do not block waiting for events and it immediately returns if there are no events to dispatch. If an event is already ready to be dispatched it will be processed.
DISPATCH_ONCE
Calls to run with this option block waiting for one event before immediately returning.

Dispatcher

run (disp, runOpt)

Invokes the dispatcher to process messages and timeouts.

This method should be called to process one or more events depending on the run option provided.

Parameters:

  • disp userdata The Dispatcher instance.
  • runOpt number One of the constant run options

Returns:

  1. bool Returns true if dispatcher successfully ran one or more event iterations. Returns false on error.
  2. string or nil An error message in the event of an error
stop (disp)

Stops the dispatcher and causes run to exit.

This is used to break out of the dispatch loop entered by calling run on the dispatcher. A Lua error is thrown if the dispatcher cannot be stopped.

Parameters:

  • disp userdata The Dispatcher instance.

Returns:

    bool True if dispatcher stops
generated by LDoc 1.3