27 static GThread *thread;
30 static gboolean want_sync = FALSE;
31 static gboolean keep_running = TRUE;
38 do_loop (gpointer udata)
45 while (keep_running) {
47 g_cond_wait (cond, mutex);
51 while (keep_running && want_sync) {
54 g_get_current_time (&time);
55 g_time_val_add (&time, 10000000);
57 g_cond_timed_wait (cond, mutex, &time);
63 g_mutex_unlock (mutex);
65 XMMS_DBG (
"Syncing collections to database.");
72 g_mutex_unlock (mutex);
84 mutex = g_mutex_new ();
86 thread = g_thread_create (do_loop, dag, TRUE, NULL);
98 g_mutex_unlock (mutex);
100 g_thread_join (thread);
102 g_mutex_free (mutex);
112 g_mutex_lock (mutex);
114 g_cond_signal (cond);
115 g_mutex_unlock (mutex);