[SCM] gsequencer/upstream: implemented more grained object locking

jkraehemann-guest at users.alioth.debian.org jkraehemann-guest at users.alioth.debian.org
Sun Jun 14 16:06:59 UTC 2015


The following commit has been merged in the upstream branch:
commit b59976e03b9b87ddfd393687b2567165c0a71e42
Author: Joël Krähemann <weedlight at gmail.com>
Date:   Fri Apr 10 10:07:01 2015 +0000

    implemented more grained object locking

diff --git a/.deps/ags-ags_audio_loop.Po b/.deps/ags-ags_audio_loop.Po
index 97f35a6..91df865 100644
--- a/.deps/ags-ags_audio_loop.Po
+++ b/.deps/ags-ags_audio_loop.Po
@@ -602,8 +602,11 @@ ags-ags_audio_loop.o: src/ags/thread/ags_audio_loop.c \
  src/ags/X/ags_preferences.h src/ags/X/ags_generic_preferences.h \
  src/ags/X/ags_audio_preferences.h \
  src/ags/X/ags_performance_preferences.h \
- src/ags/X/ags_server_preferences.h src/ags/thread/ags_export_thread.h \
- src/ags/audio/file/ags_audio_file.h src/ags/thread/ags_gui_thread.h
+ src/ags/X/ags_server_preferences.h src/ags/thread/ags_mutex_manager.h \
+ src/ags/thread/ags_export_thread.h src/ags/audio/file/ags_audio_file.h \
+ src/ags/thread/ags_gui_thread.h src/ags/audio/ags_recall_audio.h \
+ src/ags/audio/ags_recall_audio_run.h src/ags/audio/ags_recall_channel.h \
+ src/ags/audio/ags_recall_channel_run.h
 
 /usr/include/stdc-predef.h:
 
@@ -2107,8 +2110,18 @@ src/ags/X/ags_performance_preferences.h:
 
 src/ags/X/ags_server_preferences.h:
 
+src/ags/thread/ags_mutex_manager.h:
+
 src/ags/thread/ags_export_thread.h:
 
 src/ags/audio/file/ags_audio_file.h:
 
 src/ags/thread/ags_gui_thread.h:
+
+src/ags/audio/ags_recall_audio.h:
+
+src/ags/audio/ags_recall_audio_run.h:
+
+src/ags/audio/ags_recall_channel.h:
+
+src/ags/audio/ags_recall_channel_run.h:
diff --git a/.deps/ags-ags_matrix.Po b/.deps/ags-ags_matrix.Po
index 98a7c7e..ef9bde8 100644
--- a/.deps/ags-ags_matrix.Po
+++ b/.deps/ags-ags_matrix.Po
@@ -614,10 +614,11 @@ ags-ags_matrix.o: src/ags/X/machine/ags_matrix.c \
  src/ags/widget/ags_waveform.h src/ags/widget/ags_dial.h \
  src/ags/widget/ags_cartesian.h src/ags/file/ags_file_id_ref.h \
  src/ags/file/ags_file_lookup.h src/ags/file/ags_file_launch.h \
- src/ags/audio/ags_input.h /usr/include/glib-2.0/glib/gstdio.h \
- /usr/include/glib-2.0/glib/gprintf.h /usr/include/sys/stat.h \
- src/ags/audio/ags_output.h src/ags/audio/ags_pattern.h \
- src/ags/audio/ags_recall_factory.h src/ags/audio/ags_recall_container.h \
+ src/ags/thread/ags_mutex_manager.h src/ags/audio/ags_input.h \
+ /usr/include/glib-2.0/glib/gstdio.h /usr/include/glib-2.0/glib/gprintf.h \
+ /usr/include/sys/stat.h src/ags/audio/ags_output.h \
+ src/ags/audio/ags_pattern.h src/ags/audio/ags_recall_factory.h \
+ src/ags/audio/ags_recall_container.h \
  src/ags/audio/recall/ags_delay_audio.h \
  src/ags/audio/recall/ags_count_beats_audio.h \
  src/ags/audio/recall/ags_count_beats_audio_run.h \
@@ -2176,6 +2177,8 @@ src/ags/file/ags_file_lookup.h:
 
 src/ags/file/ags_file_launch.h:
 
+src/ags/thread/ags_mutex_manager.h:
+
 src/ags/audio/ags_input.h:
 
 /usr/include/glib-2.0/glib/gstdio.h:
diff --git a/.deps/ags-ags_recall_factory.Po b/.deps/ags-ags_recall_factory.Po
index ef716dd..4e15fd3 100644
--- a/.deps/ags-ags_recall_factory.Po
+++ b/.deps/ags-ags_recall_factory.Po
@@ -554,7 +554,7 @@ ags-ags_recall_factory.o: src/ags/audio/ags_recall_factory.c \
  /usr/include/libxml2/libxml/SAX2.h src/ags/thread/ags_timestamp_thread.h \
  src/ags/thread/ags_thread-posix.h src/ags/audio/ags_timestamp.h \
  src/ags/audio/ags_note.h src/ags/audio/ags_recall_container.h \
- src/ags-lib/object/ags_connectable.h \
+ src/ags-lib/object/ags_connectable.h src/ags/thread/ags_mutex_manager.h \
  src/ags/audio/ags_recall_channel_run_dummy.h \
  src/ags/audio/ags_recall_channel.h \
  src/ags/audio/ags_recall_channel_run.h src/ags/audio/ags_devout.h \
@@ -1923,6 +1923,8 @@ src/ags/audio/ags_recall_container.h:
 
 src/ags-lib/object/ags_connectable.h:
 
+src/ags/thread/ags_mutex_manager.h:
+
 src/ags/audio/ags_recall_channel_run_dummy.h:
 
 src/ags/audio/ags_recall_channel.h:
diff --git a/src/ags/X/ags_menu_bar_callbacks.c b/src/ags/X/ags_menu_bar_callbacks.c
index 62ce29e..b031c11 100644
--- a/src/ags/X/ags_menu_bar_callbacks.c
+++ b/src/ags/X/ags_menu_bar_callbacks.c
@@ -249,6 +249,8 @@ ags_menu_bar_add_panel_callback(GtkWidget *menu_item, AgsMenuBar *menu_bar)
 
   panel = ags_panel_new(G_OBJECT(window->devout));
 
+  g_message("debug -1\0");
+  
   add_audio = ags_add_audio_new(window->devout,
 				AGS_MACHINE(panel)->audio);
   ags_task_thread_append_task(AGS_TASK_THREAD(AGS_AUDIO_LOOP(AGS_MAIN(window->ags_main)->main_loop)->task_thread),
@@ -259,6 +261,9 @@ ags_menu_bar_add_panel_callback(GtkWidget *menu_item, AgsMenuBar *menu_bar)
 		     FALSE, FALSE, 0);
 
   AGS_MACHINE(panel)->audio->audio_channels = 2;
+
+  g_message("debug 0\0");
+  
   ags_audio_set_pads(AGS_MACHINE(panel)->audio,
 		     AGS_TYPE_INPUT, 1);
   ags_audio_set_pads(AGS_MACHINE(panel)->audio,
diff --git a/src/ags/X/machine/ags_matrix.c b/src/ags/X/machine/ags_matrix.c
index 517054d..ec2f479 100644
--- a/src/ags/X/machine/ags_matrix.c
+++ b/src/ags/X/machine/ags_matrix.c
@@ -34,6 +34,7 @@
 #include <ags/file/ags_file_lookup.h>
 #include <ags/file/ags_file_launch.h>
 
+#include <ags/thread/ags_mutex_manager.h>
 #include <ags/thread/ags_thread-posix.h>
 #include <ags/thread/ags_audio_loop.h>
 
@@ -116,6 +117,8 @@ GtkStyle *matrix_style;
 extern const char *AGS_COPY_PATTERN;
 const char *AGS_MATRIX_INDEX = "AgsMatrixIndex\0";
 
+extern pthread_mutex_t ags_application_mutex;
+
 GType
 ags_matrix_get_type(void)
 {
@@ -860,9 +863,25 @@ void
 ags_matrix_draw_gutter(AgsMatrix *matrix)
 {
   AgsChannel *channel;
+
+  AgsMutexManager *mutex_manager;
+
   guint gutter;
   int i, j;
 
+  pthread_mutex_t *audio_mutex;
+  
+  pthread_mutex_lock(&(ags_application_mutex));
+  
+  mutex_manager = ags_mutex_manager_get_instance();
+
+  audio_mutex = ags_mutex_manager_lookup(mutex_manager,
+					 AGS_MACHINE(matrix)->audio);
+  
+  pthread_mutex_unlock(&(ags_application_mutex));
+
+  pthread_mutex_lock(audio_mutex);
+
   gdk_draw_rectangle (GTK_WIDGET (matrix->drawing_area)->window,
                       GTK_WIDGET (matrix->drawing_area)->style->bg_gc[0],
                       TRUE,
@@ -890,15 +909,33 @@ ags_matrix_draw_gutter(AgsMatrix *matrix)
 
     channel = channel->next;
   }
+
+  pthread_mutex_unlock(audio_mutex);
 }
 
 void
 ags_matrix_draw_matrix(AgsMatrix *matrix)
 {
   AgsChannel *channel;
+
+  AgsMutexManager *mutex_manager;
+
   guint gutter;
   int i, j;
 
+  pthread_mutex_t *audio_mutex;
+
+  pthread_mutex_lock(&(ags_application_mutex));
+  
+  mutex_manager = ags_mutex_manager_get_instance();
+
+  audio_mutex = ags_mutex_manager_lookup(mutex_manager,
+					 AGS_MACHINE(matrix)->audio);
+  
+  pthread_mutex_unlock(&(ags_application_mutex));
+
+  pthread_mutex_lock(audio_mutex);
+
   channel = ags_channel_nth(AGS_MACHINE(matrix)->audio->input, (guint) matrix->adjustment->value);
 
   if(channel == NULL){
@@ -917,6 +954,8 @@ ags_matrix_draw_matrix(AgsMatrix *matrix)
 
     channel = channel->next;
   }
+
+  pthread_mutex_unlock(audio_mutex);
 }
 
 void
diff --git a/src/ags/audio/ags_audio.c b/src/ags/audio/ags_audio.c
index af4f758..613e8ad 100644
--- a/src/ags/audio/ags_audio.c
+++ b/src/ags/audio/ags_audio.c
@@ -311,7 +311,7 @@ ags_audio_init(AgsAudio *audio)
   mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
   pthread_mutex_init(mutex,
 		     &attr);
-  
+
   pthread_mutex_lock(&(ags_application_mutex));
 
   mutex_manager = ags_mutex_manager_get_instance();
@@ -421,9 +421,10 @@ ags_audio_finalize(GObject *gobject)
 
   audio = AGS_AUDIO(gobject);
 
-  if(audio->devout != NULL)
+  if(audio->devout != NULL){
     g_object_unref(audio->devout);
-
+  }
+  
   /* output */
   channel = audio->output;
 
diff --git a/src/ags/audio/ags_channel.c b/src/ags/audio/ags_channel.c
index 7ef0fff..35f619a 100644
--- a/src/ags/audio/ags_channel.c
+++ b/src/ags/audio/ags_channel.c
@@ -467,8 +467,9 @@ ags_channel_connect(AgsConnectable *connectable)
     list = list->next;
   }
 
-  if(channel->notation != NULL)
+  if(channel->notation != NULL){
     ags_connectable_connect(AGS_CONNECTABLE(channel->notation));
+  }
 }
 
 void
@@ -487,9 +488,10 @@ ags_channel_finalize(GObject *gobject)
   channel = AGS_CHANNEL(gobject);
 
   //FIXME:JK: wrong ref count
-  if(channel->audio != NULL)
+  if(channel->audio != NULL){
     //    g_object_unref(channel->audio);
-
+  }
+  
   /* AgsRecycling */
   if(((AGS_AUDIO_INPUT_HAS_RECYCLING & (AGS_AUDIO(channel->audio)->flags)) != 0 && AGS_IS_INPUT(channel)) ||
      ((AGS_AUDIO_OUTPUT_HAS_RECYCLING & (AGS_AUDIO(channel->audio)->flags)) != 0 && AGS_IS_OUTPUT(channel))){
@@ -508,12 +510,13 @@ ags_channel_finalize(GObject *gobject)
   }
 
   /* key string */
-  if(channel->note != NULL)
+  if(channel->note != NULL){
     free(channel->note);
+  }
 
-  if(channel->devout_play != NULL)
+  if(channel->devout_play != NULL){
     ags_devout_play_free(channel->devout_play);  
-
+  }
 
   /* free some lists */
   g_list_free_full(channel->recall_id,
@@ -530,9 +533,10 @@ ags_channel_finalize(GObject *gobject)
 		   g_object_unref);
 
   /* AgsNotation */
-  if(channel->notation != NULL)
+  if(channel->notation != NULL){
     g_object_unref(channel->notation);
-
+  }
+  
   /* call parent class */
   G_OBJECT_CLASS(ags_channel_parent_class)->finalize(gobject);
 }
diff --git a/src/ags/audio/ags_recall_factory.c b/src/ags/audio/ags_recall_factory.c
index 2f4acbd..0a03c87 100644
--- a/src/ags/audio/ags_recall_factory.c
+++ b/src/ags/audio/ags_recall_factory.c
@@ -20,6 +20,8 @@
 
 #include <ags-lib/object/ags_connectable.h>
 
+#include <ags/thread/ags_mutex_manager.h>
+
 #include <ags/audio/ags_recall.h>
 #include <ags/audio/ags_recall_channel_run_dummy.h>
 #include <ags/audio/ags_recall_recycling_dummy.h>
@@ -163,6 +165,8 @@ GList* ags_recall_factory_create_ladspa(AgsAudio *audio,
 
 static gpointer ags_recall_factory_parent_class = NULL;
 
+extern pthread_mutex_t ags_application_mutex;
+
 GType
 ags_recall_factory_get_type (void)
 {
@@ -2206,6 +2210,20 @@ ags_recall_factory_create(AgsAudio *audio,
 			  guint create_flags, guint recall_flags)
 {
   GList *list;
+  AgsMutexManager *mutex_manager;
+
+  pthread_mutex_t *audio_mutex;
+  
+  pthread_mutex_lock(&(ags_application_mutex));
+  
+  mutex_manager = ags_mutex_manager_get_instance();
+
+  audio_mutex = ags_mutex_manager_lookup(mutex_manager,
+					 audio);
+  
+  pthread_mutex_unlock(&(ags_application_mutex));
+
+  pthread_mutex_lock(audio_mutex);
 
   list = NULL;
 
@@ -2332,6 +2350,8 @@ ags_recall_factory_create(AgsAudio *audio,
 				     create_flags, recall_flags);
   }
 
+  pthread_mutex_unlock(audio_mutex);
+
   return(list);
 }
 
diff --git a/src/ags/thread/ags_audio_loop.c b/src/ags/thread/ags_audio_loop.c
index 548f3c9..41ddc6a 100644
--- a/src/ags/thread/ags_audio_loop.c
+++ b/src/ags/thread/ags_audio_loop.c
@@ -24,6 +24,7 @@
 
 #include <ags/object/ags_main_loop.h>
 
+#include <ags/thread/ags_mutex_manager.h>
 #include <ags/thread/ags_export_thread.h>
 #include <ags/thread/ags_gui_thread.h>
 
@@ -31,6 +32,10 @@
 #include <ags/audio/ags_audio.h>
 #include <ags/audio/ags_channel.h>
 #include <ags/audio/ags_recall.h>
+#include <ags/audio/ags_recall_audio.h>
+#include <ags/audio/ags_recall_audio_run.h>
+#include <ags/audio/ags_recall_channel.h>
+#include <ags/audio/ags_recall_channel_run.h>
 
 void ags_audio_loop_class_init(AgsAudioLoopClass *audio_loop);
 void ags_audio_loop_connectable_interface_init(AgsConnectableInterface *connectable);
@@ -88,6 +93,8 @@ extern pthread_mutex_t ags_application_mutex;
 static gpointer ags_audio_loop_parent_class = NULL;
 static AgsConnectableInterface *ags_audio_loop_parent_connectable_interface;
 
+extern pthread_mutex_t ags_application_mutex;
+
 GType
 ags_audio_loop_get_type()
 {
@@ -617,19 +624,12 @@ ags_audio_loop_start(AgsThread *thread)
 void
 ags_audio_loop_run(AgsThread *thread)
 {
-  GMutex mutex;
-  GCond cond;
   AgsAudioLoop *audio_loop;
-  AgsDevout *devout;
+
   guint val;
 
   audio_loop = AGS_AUDIO_LOOP(thread);
 
-  devout = AGS_DEVOUT(AGS_THREAD(audio_loop)->devout);
-
-  pthread_mutex_lock(&(ags_application_mutex));
-  pthread_mutex_lock(&(audio_loop->recall_mutex));
-
   /* play recall */
   if((AGS_AUDIO_LOOP_PLAY_RECALL & (audio_loop->flags)) != 0){
     ags_audio_loop_play_recall(audio_loop);
@@ -657,8 +657,6 @@ ags_audio_loop_run(AgsThread *thread)
     }
   }
 
-  pthread_mutex_unlock(&(ags_application_mutex));
-
   /* decide if we stop */
   if(audio_loop->play_recall_ref == 0 &&
      audio_loop->play_channel_ref == 0 &&
@@ -723,9 +721,15 @@ ags_audio_loop_play_recall(AgsAudioLoop *audio_loop)
   AgsDevoutPlay *devout_play;
   AgsRecall *recall;
   //  AgsRecallID *recall_id;
+
+  AgsMutexManager *mutex_manager;
+
   GList *list, *list_next;
   guint stage;
 
+  pthread_mutex_t *devout_mutex, *audio_mutex;
+
+  /*  */
   audio_loop->flags |= AGS_AUDIO_LOOP_PLAYING_RECALL;
   stage = 0;
 
@@ -744,10 +748,58 @@ ags_audio_loop_play_recall(AgsAudioLoop *audio_loop)
 
   audio_loop->flags &= (~AGS_AUDIO_LOOP_PLAY_RECALL_TERMINATING);
 
+  pthread_mutex_lock(&(ags_application_mutex));
+
+  mutex_manager = ags_mutex_manager_get_instance();
+
+  pthread_mutex_unlock(&(ags_application_mutex));
+
   while(list != NULL){
+    AgsAudio *audio;
+    
     devout_play = AGS_DEVOUT_PLAY(list->data);
     recall = AGS_RECALL(devout_play->source);
 
+    audio = NULL;
+
+    if(AGS_IS_RECALL_AUDIO(recall)){
+      g_object_get(recall,
+		   "audio\0", &audio,
+		   NULL);
+    }else if(AGS_IS_RECALL_AUDIO_RUN(recall)){
+      g_object_get(AGS_RECALL_AUDIO_RUN(recall)->recall_audio,
+		   "audio\0", &audio,
+		   NULL);
+    }else if(AGS_IS_RECALL_CHANNEL(recall) ||
+	     AGS_IS_RECALL_CHANNEL_RUN(recall)){
+      AgsChannel *source;
+      
+      g_object_get(recall,
+		   "source\0", &source,
+		   NULL);
+
+      audio = source->audio;
+    }
+    
+    /*  */
+    pthread_mutex_lock(&(ags_application_mutex));
+
+    devout_mutex = ags_mutex_manager_lookup(mutex_manager,
+					    recall->devout);
+    
+    if(audio != NULL){      
+      audio_mutex = ags_mutex_manager_lookup(mutex_manager,
+					     audio);
+    }
+
+    pthread_mutex_lock(devout_mutex);
+
+    if(audio != NULL){      
+      pthread_mutex_lock(audio_mutex);
+    }
+    
+    pthread_mutex_unlock(&(ags_application_mutex));
+    
     //    recall_id = devout_play->recall_id;
     list_next = list->next;
 
@@ -766,6 +818,12 @@ ags_audio_loop_play_recall(AgsAudioLoop *audio_loop)
       g_object_unref(recall);
       free(devout_play);
     }
+    
+    if(audio != NULL){
+      pthread_mutex_lock(audio_mutex);
+    }
+    
+    pthread_mutex_lock(devout_mutex);
 
     list = list_next;
   }
@@ -796,9 +854,14 @@ ags_audio_loop_play_channel(AgsAudioLoop *audio_loop)
 {
   AgsDevoutPlay *play;
   AgsChannel *channel;
+
+  AgsMutexManager *mutex_manager;
+
   GList *list_play, *list_next_play;
   gint stage;
 
+  pthread_mutex_t *devout_mutex, *audio_mutex;
+
   if(audio_loop->play_channel == NULL){
     if((AGS_AUDIO_LOOP_PLAY_CHANNEL_TERMINATING & (audio_loop->flags)) != 0){
       audio_loop->flags &= (~(AGS_AUDIO_LOOP_PLAY_CHANNEL |
@@ -810,6 +873,13 @@ ags_audio_loop_play_channel(AgsAudioLoop *audio_loop)
 
   audio_loop->flags &= (~AGS_AUDIO_LOOP_PLAY_CHANNEL_TERMINATING);
 
+  /*  */
+  pthread_mutex_lock(&(ags_application_mutex));
+
+  mutex_manager = ags_mutex_manager_get_instance();
+
+  pthread_mutex_unlock(&(ags_application_mutex));
+
   /* entry point */
   audio_loop->flags |= AGS_AUDIO_LOOP_PLAYING_CHANNEL;
 
@@ -825,6 +895,20 @@ ags_audio_loop_play_channel(AgsAudioLoop *audio_loop)
       play = (AgsDevoutPlay *) list_play->data;
       channel = AGS_CHANNEL(play->source);
 
+      /*  */
+      pthread_mutex_lock(&(ags_application_mutex));
+
+      devout_mutex = ags_mutex_manager_lookup(mutex_manager,
+					      AGS_AUDIO(channel->audio)->devout);
+      audio_mutex = ags_mutex_manager_lookup(mutex_manager,
+					     channel->audio);
+      
+      pthread_mutex_unlock(&(ags_application_mutex));
+      
+      pthread_mutex_lock(devout_mutex);
+      pthread_mutex_lock(audio_mutex);
+      
+      /*  */
       if((AGS_DEVOUT_PLAY_REMOVE & (play->flags)) == 0){
 	remove_play = FALSE;
 	if((AGS_DEVOUT_PLAY_SUPER_THREADED & (play->flags)) == 0){
@@ -872,6 +956,9 @@ ags_audio_loop_play_channel(AgsAudioLoop *audio_loop)
 	//TODO:JK: verify g_object_unref() missing
       }
 
+      pthread_mutex_lock(audio_mutex);
+      pthread_mutex_lock(devout_mutex);
+
       list_play = list_next_play;
     }
   }
@@ -893,10 +980,15 @@ ags_audio_loop_play_audio(AgsAudioLoop *audio_loop)
   AgsDevoutPlay *play;
   AgsAudio *audio;
   AgsChannel *output;
+
+  AgsMutexManager *mutex_manager;
+
   GList *list_play_domain, *list_next_play_domain;
   GList *list_play;
   gint stage;
 
+  pthread_mutex_t *devout_mutex, *audio_mutex;
+
   if(audio_loop->play_audio == NULL){
     if((AGS_AUDIO_LOOP_PLAY_AUDIO_TERMINATING & (audio_loop->flags)) != 0){
       audio_loop->flags &= (~(AGS_AUDIO_LOOP_PLAY_AUDIO |
@@ -908,6 +1000,13 @@ ags_audio_loop_play_audio(AgsAudioLoop *audio_loop)
 
   audio_loop->flags &= (~AGS_AUDIO_LOOP_PLAY_AUDIO_TERMINATING);
 
+  /*  */
+  pthread_mutex_lock(&(ags_application_mutex));
+
+  mutex_manager = ags_mutex_manager_get_instance();
+
+  pthread_mutex_unlock(&(ags_application_mutex));
+
   /* entry point */
   audio_loop->flags |= AGS_AUDIO_LOOP_PLAYING_AUDIO;
 
@@ -923,6 +1022,20 @@ ags_audio_loop_play_audio(AgsAudioLoop *audio_loop)
       play_domain = (AgsDevoutPlayDomain *) list_play_domain->data;
       audio = AGS_AUDIO(play_domain->domain);
 
+      /*  */
+      pthread_mutex_lock(&(ags_application_mutex));
+
+      devout_mutex = ags_mutex_manager_lookup(mutex_manager,
+					      audio->devout);
+      audio_mutex = ags_mutex_manager_lookup(mutex_manager,
+					     audio);
+      
+      pthread_mutex_unlock(&(ags_application_mutex));
+      
+      pthread_mutex_lock(devout_mutex);
+      pthread_mutex_lock(audio_mutex);
+      
+      /*  */
       output = audio->output;
       remove_domain = TRUE;
 
@@ -997,6 +1110,11 @@ ags_audio_loop_play_audio(AgsAudioLoop *audio_loop)
 	}
       }
 
+      /*  */
+      pthread_mutex_lock(audio_mutex);
+      pthread_mutex_lock(devout_mutex);
+
+      /* iterate */
       list_play_domain = list_next_play_domain;
     }
   }
diff --git a/src/ags/thread/ags_gui_thread.c b/src/ags/thread/ags_gui_thread.c
index dfc25a2..2e3a6ef 100644
--- a/src/ags/thread/ags_gui_thread.c
+++ b/src/ags/thread/ags_gui_thread.c
@@ -52,8 +52,6 @@ void ags_gui_thread_suspend_handler(int sig);
  * The #AgsGuiThread acts as graphical user interface thread.
  */
 
-extern pthread_mutex_t ags_application_mutex;
-
 static gpointer ags_gui_thread_parent_class = NULL;
 static AgsConnectableInterface *ags_gui_thread_parent_connectable_interface;
 
@@ -253,8 +251,6 @@ ags_gui_thread_run(AgsThread *thread)
     g_main_context_release(main_context);
   }
 
-  pthread_mutex_lock(&(ags_application_mutex));
-
   gui_thread = AGS_GUI_THREAD(thread);
   audio_loop = AGS_AUDIO_LOOP(thread->parent);
   task_thread = AGS_TASK_THREAD(audio_loop->task_thread);
@@ -263,8 +259,6 @@ ags_gui_thread_run(AgsThread *thread)
   main_context = g_main_context_default();
 
   ags_gui_thread_do_gtk_iteration();
-
-  pthread_mutex_unlock(&(ags_application_mutex));
 }
 
 void

-- 
gsequencer packaging



More information about the pkg-multimedia-commits mailing list