#include <timeout-pool.h>
Public Types | |
typedef sigc::slot< bool > | TimeoutSlot |
Public Member Functions | |
TimeoutPool (int priority) | |
guint | add (guint interval, const TimeoutSlot &func, int priority=Glib::PRIORITY_DEFAULT) |
Sets a function to be called at regular intervals, and puts it inside the pool. | |
void | remove (guint id) |
Removes a timeout function with id from the timeout pool. | |
ClutterTimeoutPool * | gobj () |
const ClutterTimeoutPool * | gobj () const |
Protected Attributes | |
ClutterTimeoutPool * | gobject_ |
A timeout pool allocates a single time slice of the main loop and runs every timeout function inside it. The timeout pool is always sorted, so that the extraction of the next timeout function is a constant time operation.
Inside Clutter, every Timeline share the same timeout pool, unless the CLUTTER_TIMELINE=no-pool environment variable is set.
typedef sigc::slot<bool> Clutter::TimeoutPool::TimeoutSlot |
Clutter::TimeoutPool::TimeoutPool | ( | int | priority | ) | [explicit] |
guint Clutter::TimeoutPool::add | ( | guint | interval, | |
const TimeoutSlot & | func, | |||
int | priority = Glib::PRIORITY_DEFAULT | |||
) |
Sets a function to be called at regular intervals, and puts it inside the pool.
The function is repeatedly called until it returns false
, at which point the timeout is automatically destroyed and the function won't be called again. If notify is not 0
, the notify function will be called. The first call to func will be at the end of interval.
Since version 0.8 this will try to compensate for delays. For example, if func takes half the interval time to execute then the function will be called again half the interval time after it finished. Before version 0.8 it would not fire until a full interval after the function completes so the delay between calls would be interval * 1.5. This function does not however try to invoke the function multiple times to catch up missing frames if func takes more than interval ms to execute.
interval | The time between calls to the function, in milliseconds. | |
func | Function to call. | |
data | Data to pass to the function, or 0 . | |
notify | Function to call when the timeout is removed, or 0 . |
void Clutter::TimeoutPool::remove | ( | guint | id | ) |
Removes a timeout function with id from the timeout pool.
The id is the same returned when adding a function to the timeout pool with clutter_timeout_pool_add().
Since: 0.4
id | The id of the timeout to remove. |
ClutterTimeoutPool* Clutter::TimeoutPool::gobj | ( | ) | [inline] |
References gobject_.
const ClutterTimeoutPool* Clutter::TimeoutPool::gobj | ( | ) | const [inline] |
References gobject_.
ClutterTimeoutPool* Clutter::TimeoutPool::gobject_ [protected] |
Referenced by gobj().