Fixed thread initialization code.

Now it works well for older and newer GLib versions

Signed-off-by: Gergely POLONKAI <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely POLONKAI 2012-05-19 11:50:56 +02:00
parent 963d78b9e5
commit e9e78e825c
2 changed files with 8 additions and 0 deletions

View File

@ -116,7 +116,11 @@ wmud_game_init(GThread **game_thread, GMainContext **game_context)
g_source_unref(timeout_source); g_source_unref(timeout_source);
g_clear_error(&err); g_clear_error(&err);
#if GLIB_CHECK_VERSION(2,32,0)
*game_thread = g_thread_new("game", (GThreadFunc)game_thread_func, game_loop);
#else
*game_thread = g_thread_create((GThreadFunc)game_thread_func, game_loop, TRUE, &err); *game_thread = g_thread_create((GThreadFunc)game_thread_func, game_loop, TRUE, &err);
#endif
return TRUE; return TRUE;
} }

View File

@ -204,6 +204,10 @@ wmud_maintenance_init(void)
g_source_attach(timeout_source, maint_context); g_source_attach(timeout_source, maint_context);
g_source_unref(timeout_source); g_source_unref(timeout_source);
#if GLIB_CHECK_VERSION(2,32,0)
g_thread_new("maintenance", (GThreadFunc)maint_thread_func, maint_loop); g_thread_new("maintenance", (GThreadFunc)maint_thread_func, maint_loop);
#else
g_thread_create((GThreadFunc)maint_thread_func, maint_loop, TRUE, NULL);
#endif
} }