diff --git a/src/Backends/Audio/SoftwareMixer/Solaris.cpp b/src/Backends/Audio/SoftwareMixer/Solaris.cpp index 02e014a4..23f47d39 100644 --- a/src/Backends/Audio/SoftwareMixer/Solaris.cpp +++ b/src/Backends/Audio/SoftwareMixer/Solaris.cpp @@ -20,6 +20,9 @@ static const int bufferSize = 300; static const int samplingRate = 8000; +static pthread_mutex_t mixerMutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t organyaMutex = PTHREAD_MUTEX_INITIALIZER; + static int buffersWritten = 0; static int sndfp; static FILE* sndfile; @@ -118,6 +121,9 @@ unsigned long SoftwareMixerBackend_Init(void (*callback)(long *stream, size_t fr audioInfo.play = info; ioctl(sndfp, AUDIO_SETINFO, &audioInfo); + pthread_mutex_init(&mixerMutex, NULL); + pthread_mutex_init(&organyaMutex, NULL); + pthread_t thread; pthread_attr_t thread_attr; pthread_attr_init(&thread_attr); @@ -136,13 +142,17 @@ bool SoftwareMixerBackend_Start(void) { } void SoftwareMixerBackend_LockMixerMutex(void) { + pthread_mutex_lock(&mixerMutex); } void SoftwareMixerBackend_UnlockMixerMutex(void) { + pthread_mutex_unlock(&mixerMutex); } void SoftwareMixerBackend_LockOrganyaMutex(void) { + pthread_mutex_lock(&organyaMutex); } void SoftwareMixerBackend_UnlockOrganyaMutex(void) { + pthread_mutex_unlock(&organyaMutex); }