ports

morpheus ports
git clone git://git.2f30.org/ports
Log | Files | Refs | LICENSE

alsa-lib-portable-mutex.patch (867B)


      1 --- alsa-lib-1.0.27.2.orig/src/conf.c
      2 +++ alsa-lib-1.0.27.2/src/conf.c
      3 @@ -427,8 +427,8 @@
      4  #ifndef DOC_HIDDEN
      5  
      6  #ifdef HAVE_LIBPTHREAD
      7 -static pthread_mutex_t snd_config_update_mutex =
      8 -				PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
      9 +static pthread_mutex_t snd_config_update_mutex;
     10 +static pthread_once_t snd_config_update_mutex_once = PTHREAD_ONCE_INIT;
     11  #endif
     12  
     13  struct _snd_config {
     14 @@ -472,8 +472,19 @@
     15  
     16  #ifdef HAVE_LIBPTHREAD
     17  
     18 +static void snd_config_init_mutex(void)
     19 +{
     20 +	pthread_mutexattr_t attr;
     21 +
     22 +	pthread_mutexattr_init(&attr);
     23 +	pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
     24 +	pthread_mutex_init(&snd_config_update_mutex, &attr);
     25 +	pthread_mutexattr_destroy(&attr);
     26 +}
     27 +
     28  static inline void snd_config_lock(void)
     29  {
     30 +	pthread_once(&snd_config_update_mutex_once, snd_config_init_mutex);
     31  	pthread_mutex_lock(&snd_config_update_mutex);
     32  }
     33