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);
void xmms_coll_sync_init(xmms_coll_dag_t *dag)
Get the collection-to-database-synchronization thread running.
void xmms_coll_sync_shutdown()
Shutdown the collection-to-database-synchronization thread.
void xmms_coll_sync_schedule_sync()
Schedule a collection-to-database-synchronization in 10 seconds.
#define XMMS_DBG(fmt,...)
void xmms_collection_sync(xmms_coll_dag_t *dag)
Synchronize collection data to the database (i.e.
struct xmms_coll_dag_St xmms_coll_dag_t