{
GSource source;
- GStaticMutex mutex;
guint next_id;
GList *timeouts;
guint id;
};
-#define LOCK_POOL(pool) g_static_mutex_lock (&pool->mutex);
-#define UNLOCK_POOL(pool) g_static_mutex_unlock (&pool->mutex);
-
#define TIMEOUT_REMOVED(timeout) ((timeout->flags & CLUTTER_TIMEOUT_ACTIVE) == 0)
#define TIMEOUT_READY(timeout) ((timeout->flags & CLUTTER_TIMEOUT_READY) == 1)
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
GList *l = pool->timeouts;
- LOCK_POOL (pool);
-
for (l = pool->timeouts; l; l = l->next)
{
ClutterTimeout *timeout = l->data;
break;
}
- UNLOCK_POOL (pool);
-
return (pool->ready > 0);
}
GList *l = pool->timeouts;
gboolean sort_needed = FALSE;
- LOCK_POOL (pool);
-
/* the main loop might have predicted this, so we repeat the
* check for ready timeouts.
*/
if (!pool->ready)
- {
- UNLOCK_POOL (pool);
- clutter_timeout_pool_check (source);
- LOCK_POOL (pool);
- }
+ clutter_timeout_pool_check (source);
while (l && l->data && (pool->ready-- > 0))
{
pool->ready = 0;
- UNLOCK_POOL (pool);
-
return TRUE;
}
{
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
- g_static_mutex_free (&pool->mutex);
-
g_list_foreach (pool->timeouts, (GFunc) clutter_timeout_free, NULL);
g_list_free (pool->timeouts);
}
g_source_set_priority (source, priority);
pool = (ClutterTimeoutPool *) source;
- g_static_mutex_init (&pool->mutex);
pool->next_id = 1;
pool->id = g_source_attach (source, NULL);
g_source_unref (source);
ClutterTimeout *timeout;
guint retval = 0;
- LOCK_POOL (pool);
-
timeout = clutter_timeout_new (interval);
timeout->flags |= CLUTTER_TIMEOUT_ACTIVE;
pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
clutter_timeout_sort);
- UNLOCK_POOL (pool);
-
return retval;
}
{
GList *l;
- LOCK_POOL (pool);
-
l = g_list_find_custom (pool->timeouts, GUINT_TO_POINTER (id),
clutter_timeout_find_by_id);
if (l)
timeout->flags &= ~CLUTTER_TIMEOUT_ACTIVE;
}
-
- UNLOCK_POOL (pool);
}