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);
void xmms_set_thread_name(const gchar *name)
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