[master clock] Fix MT safety issues

Fix MT issues when enabling threading in Clutter.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1655

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Ole André Vadla Ravnås 2009-06-18 23:53:46 +02:00 committed by Emmanuele Bassi
parent ba6c0c27f9
commit c272a7b2a2

View File

@ -212,7 +212,9 @@ clutter_clock_prepare (GSource *source,
ClutterMasterClock *master_clock = clock_source->master_clock;
int delay;
clutter_threads_enter ();
delay = master_clock_next_frame_delay (master_clock);
clutter_threads_leave ();
*timeout = delay;
@ -226,7 +228,9 @@ clutter_clock_check (GSource *source)
ClutterMasterClock *master_clock = clock_source->master_clock;
int delay;
clutter_threads_enter ();
delay = master_clock_next_frame_delay (master_clock);
clutter_threads_leave ();
return delay == 0;
}
@ -243,6 +247,8 @@ clutter_clock_dispatch (GSource *source,
CLUTTER_NOTE (SCHEDULER, "Master clock [tick]");
clutter_threads_enter ();
/* Get the time to use for this frame.
*/
g_source_get_current_time (source, &master_clock->cur_tick);
@ -274,6 +280,8 @@ clutter_clock_dispatch (GSource *source,
master_clock->prev_tick = master_clock->cur_tick;
clutter_threads_leave ();
return TRUE;
}