28 static GThread *thread;
31 static gboolean want_sync = FALSE;
32 static gboolean keep_running = TRUE;
39 do_loop (gpointer udata)
48 while (keep_running) {
50 g_cond_wait (cond, mutex);
54 while (keep_running && want_sync) {
57 g_get_current_time (&time);
58 g_time_val_add (&time, 10000000);
60 g_cond_timed_wait (cond, mutex, &time);
66 g_mutex_unlock (mutex);
68 XMMS_DBG (
"Syncing collections to database.");
75 g_mutex_unlock (mutex);
87 mutex = g_mutex_new ();
89 thread = g_thread_create (do_loop, dag, TRUE, NULL);
100 g_cond_signal (cond);
101 g_mutex_unlock (mutex);
103 g_thread_join (thread);
105 g_mutex_free (mutex);
115 g_mutex_lock (mutex);
117 g_cond_signal (cond);
118 g_mutex_unlock (mutex);