Clutter::TimeoutPool Class Reference

A timeout pool should be used when multiple timeout functions, running at the same priority, are needed and the Glib::SignalTimeout API might lead to starvation of the time slice of the main loop. More...

#include <timeout-pool.h>

List of all members.

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_


Detailed Description

A timeout pool should be used when multiple timeout functions, running at the same priority, are needed and the Glib::SignalTimeout API might lead to starvation of the time slice of the main loop.

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.


Member Typedef Documentation

typedef sigc::slot<bool> Clutter::TimeoutPool::TimeoutSlot


Constructor & Destructor Documentation

Clutter::TimeoutPool::TimeoutPool ( int  priority  )  [explicit]


Member Function Documentation

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.

Parameters:
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.
Returns:
The ID (greater than 0) of the timeout inside the pool. Use clutter_timeout_pool_remove() to stop the timeout.
Since: 0.4.

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

Parameters:
id The id of the timeout to remove.

ClutterTimeoutPool* Clutter::TimeoutPool::gobj (  )  [inline]

const ClutterTimeoutPool* Clutter::TimeoutPool::gobj (  )  const [inline]


Member Data Documentation

ClutterTimeoutPool* Clutter::TimeoutPool::gobject_ [protected]


The documentation for this class was generated from the following file:
Generated on Sun Jul 27 21:36:01 2008 for cluttermm by  doxygen 1.5.4