Author: toshok
Date: 2007-07-20 12:51:35 -0400 (Fri, 20 Jul 2007)
New Revision: 82369
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/clock.cpp
trunk/moon/src/clock.h
Log:
2007-07-20 Chris Toshok <[EMAIL PROTECTED]>
* clock.h, clock.cpp: lock around access to the tick_call list, so
tick calls can be added from other threads.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-07-20 16:30:24 UTC (rev 82368)
+++ trunk/moon/src/ChangeLog 2007-07-20 16:51:35 UTC (rev 82369)
@@ -1,3 +1,8 @@
+2007-07-20 Chris Toshok <[EMAIL PROTECTED]>
+
+ * clock.h, clock.cpp: lock around access to the tick_call list, so
+ tick calls can be added from other threads.
+
2007-07-16 Miguel de Icaza <[EMAIL PROTECTED]>
* media.cpp (SetSource): Also handle Completed.
Modified: trunk/moon/src/clock.cpp
===================================================================
--- trunk/moon/src/clock.cpp 2007-07-20 16:30:24 UTC (rev 82368)
+++ trunk/moon/src/clock.cpp 2007-07-20 16:51:35 UTC (rev 82369)
@@ -71,6 +71,8 @@
{
start_time = get_now ();
+ tick_call_mutex = g_mutex_new ();
+
UpdateInputEvent = RegisterEvent ("update-input");
RenderEvent = RegisterEvent ("render");
}
@@ -129,6 +131,8 @@
TimeManager::InvokeTickCall ()
{
if (tick_calls) {
+ g_mutex_lock (tick_call_mutex);
+
TickCall *call = (TickCall*)tick_calls->data;
// unlink the call first
@@ -136,6 +140,8 @@
g_list_free_1 (tick_calls);
tick_calls = new_tick_calls;
+ g_mutex_unlock (tick_call_mutex);
+
// now invoke it
call->func (call->data);
g_free (call);
@@ -213,7 +219,9 @@
TickCall *call = g_new (TickCall, 1);
call->func = func;
call->data = tick_data;
+ g_mutex_lock (tick_call_mutex);
tick_calls = g_list_append (tick_calls, call);
+ g_mutex_unlock (tick_call_mutex);
}
void
Modified: trunk/moon/src/clock.h
===================================================================
--- trunk/moon/src/clock.h 2007-07-20 16:30:24 UTC (rev 82368)
+++ trunk/moon/src/clock.h 2007-07-20 16:51:35 UTC (rev 82369)
@@ -204,6 +204,8 @@
TimeManagerOp flags;
+ GMutex *tick_call_mutex;
+
GList *tick_calls;
};
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches