changeset 143:32c320bba8a6 trunk

[svn] Mutex system
author nenolod
date Thu, 10 Nov 2005 16:40:09 -0800
parents 5ce1d36e9ff5
children 0faf2fa7fc85
files audacious/input.h audacious/playback.c
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/input.h	Thu Nov 10 15:56:32 2005 -0800
+++ b/audacious/input.h	Thu Nov 10 16:40:09 2005 -0800
@@ -31,6 +31,7 @@
     InputPlugin *current_input_plugin;
     gboolean playing;
     gboolean paused;
+    GMutex *playback_mutex;
 };
 
 GList *get_input_list(void);
--- a/audacious/playback.c	Thu Nov 10 15:56:32 2005 -0800
+++ b/audacious/playback.c	Thu Nov 10 16:40:09 2005 -0800
@@ -91,6 +91,10 @@
     if (bmp_playback_get_playing())
         bmp_playback_stop();
 
+    ip_data.playback_mutex = g_mutex_new();
+
+    g_mutex_lock(ip_data.playback_mutex);
+
     vis_clear_data(mainwin_vis);
     vis_clear_data(playlistwin_vis);
     svis_clear_data(mainwin_svis);
@@ -114,6 +118,8 @@
 
     playlist_check_pos_current();
     mainwin_set_info_text();
+
+    g_mutex_unlock(ip_data.playback_mutex);
 }
 
 void
@@ -138,6 +144,8 @@
 void
 bmp_playback_stop(void)
 {
+    g_mutex_lock(ip_data.playback_mutex);
+
     if (ip_data.playing && get_current_input_plugin()) {
         ip_data.playing = FALSE;
 
@@ -158,6 +166,9 @@
     }
 
     ip_data.playing = FALSE;
+
+    g_mutex_unlock(ip_data.playback_mutex);
+    g_mutex_free(ip_data.playback_mutex);
 }