Ubuntu TV Media Scanner
A centralized index for removable media content.
|
The Timeout class provides access to GLib's timeout mechanism. More...
#include <mediascanner/glibutils.h>
Public Types | |
typedef boost::posix_time::time_duration | Duration |
This type describes time durations. More... | |
![]() | |
typedef std::function< bool()> | SourceFunction |
The signature of a regular idle source. More... | |
typedef std::function< void()> | OneCallFunction |
The signature of a single-call idle source. More... | |
Static Public Member Functions | |
static unsigned | Add (Duration interval, const SourceFunction &function, int priority=G_PRIORITY_DEFAULT_IDLE) |
Adds a new timeout function to the event loop. More... | |
static unsigned | AddOnce (Duration interval, const OneCallFunction &function, int priority=G_PRIORITY_DEFAULT_IDLE) |
Adds a new timeout function to the event loop that is called exactly once. More... | |
![]() | |
static bool | Remove (unsigned id) |
Removes an event source handler. More... | |
Additional Inherited Members | |
![]() | |
static gboolean | on_source_function (gpointer data) |
static gboolean | on_one_call_function (gpointer data) |
The Timeout class provides access to GLib's timeout mechanism.
It manages functions which get called whenever a given time interval has passed.
Note that timeout functions might get delayed if the event loop gets blocked by other sources.
typedef boost::posix_time::time_duration mediascanner::Timeout::Duration |
This type describes time durations.
Note that the duration's resolution impacts which resolution the timeout source will have.
|
inlinestatic |
Adds a new timeout function to the event loop.
The timeout gets automatically removed from the list of event sources if function
returns false
.
Note that the exact timeout mechanism is selected upon the interval
parameter's resolution. If the resolution is in seconds (or even less granular) timeout sources of seconds precision are created. Otherwise the sources have milliseconds resolution.
interval | The time between calls to the function. |
function | The function to be called on idle. |
priority | The priority of the idle source. |
|
inlinestatic |
Adds a new timeout function to the event loop that is called exactly once.
After its invocation the timeout gets automatically removed from the list of event sources if function
returns false
.
Note that the exact timeout mechanism is selected upon the interval
parameter's resolution. If the resolution is in seconds (or even less granular) timeout sources of seconds precision are created. Otherwise the sources have milliseconds resolution.
interval | The time between calls to the function. |
function | The function to be called on idle. |
priority | The priority of the idle source. |