Module l2dbus-ev
The L2DBUS libev main loop implementation.
This module provides the main-loop abstraction around the libev library.
Functions
shutdown () | |
getVersion () | |
MainLoop.new (loop) |
Tables
mainLoopEvVersionInfo | Libev main loop module version table. |
Functions
- shutdown ()
-
Shuts down the L2DBUS libev-based main loop module and frees resources.
This function frees secondary resources acquired when the module is loaded and required to support a libev main loop. It does not terminate or de-allocate the libev-based main loop itself (this should be done prior to making this call). After this call is made any main loop created by this module should no longer be utilized by L2DBUS and doing so may result in a system crash.
Note: Typically, it is unnecessary to shutdown this module since these resources will be reclaimed when the client application terminates and the module is unloaded. This function is provided to aid in debugging and profiling memory usage.
- getVersion ()
-
Returns version information about the L2DBUS libev module.
This function returns a table containing useful version information related to the module itself and underlying libraries.
Returns:
- MainLoop.new (loop)
-
Creates a new L2DBUS libev-based main loop.
Constructs a new main loop using an (optionally) provided Lua libev ev.Loop object, a lightuserdata item referencing a libev main loop, or if none is provided, internally utilize the default libev main loop to handle events. Any Lua libev loop or lightuserdata that is passed into this constructor is not owned by this object and will not be de-allocated when it is collected by the Lua garbage collector. If a Lua ev.Loop userdata is passed in it will, however, hold a reference to that. In the case of a Lua ev.Loop or lightuserdata object it is the responsibility of the caller to dispose of the loop appropriately at program termination (if required).
Note: If passing in a Lua libev main loop (ev.Loop) please insure that only the default loop (ev.Loop.default) is used and that it has been fully instantiated by calling a function that consumes a ev.Loop, e.g.
loop = ev.Loop.default loop:now()
By default the libev ev.Loop objects are lazily realized (even the default one). It's possible to unwittingly pass an unrealized Lua libev main loop to this function which will cause it to fail. Also, it's critical that only the default libev ev.Loop.default is used since it's isn't prematurely destroyed when the Lua libev modules is garbage collected by Lua at program termination. Using a Lua libev module that is instantiated via ev.Loop.new() can result in an assertion at program termination if it's being utilized by L2DBUS.
See libev for additional information on the underlying main loop library.
Parameters:
- loop ev.Loop, lightuserdata or nil Optional Lua libev main loop or raw libev main loop pointer passed as a lightuserdata. If nil is specified instead then the default libev main loop will be used. This is generally the recommended approach.
Returns:
-
userdata
MainLoop userdata object
Tables
- mainLoopEvVersionInfo
-
Libev main loop module version table.
A table containing version information for the libev-based main loop module.
Fields:
- evMajorLink The major version of the linked libev library.
- evMinorLink The minor version of the linked libev library.
- evMajorCompiled The major version of the compiled against libev library.
- evMinorCompiled The minor version of the compiled against libev library.
- mainLoopEvMajor The libev main loop major version.
- mainLoopEvMinor The libev main loop minor version.
- mainLoopEvRelease The libev main loop release version.
- copyright The L2DBUS libev main loop module copyright information.
- author The L2DBUS libev main loop author information.