[13/16] winecoreaudio: Change to faster non-recursive mutex.

Ken Thomases ken at codeweavers.com
Thu Dec 21 03:49:51 CST 2006


Since the mutex is now only used around manipulation of the queue and state,
and not around any callouts, there's no chance for recursion.
---
  dlls/winmm/winecoreaudio/audio.c |    8 +-------
  1 files changed, 1 insertions(+), 7 deletions(-)
-------------- next part --------------
diff --git a/dlls/winmm/winecoreaudio/audio.c b/dlls/winmm/winecoreaudio/audio.c
index 105c0b9..901b7dd 100644
--- a/dlls/winmm/winecoreaudio/audio.c
+++ b/dlls/winmm/winecoreaudio/audio.c
@@ -438,7 +438,6 @@ LONG CoreAudio_WaveInit(void)
     OSStatus status;
     UInt32 propertySize;
     CHAR szPname[MAXPNAMELEN];
-    pthread_mutexattr_t mutexattr;
     int i;
     HANDLE hThread;
     CFStringRef  messageThreadPortName;
@@ -472,9 +471,6 @@ LONG CoreAudio_WaveInit(void)
     CoreAudio_DefaultDevice.interface_name=HeapAlloc(GetProcessHeap(),0,strlen(CoreAudio_DefaultDevice.dev_name)+1);
     sprintf(CoreAudio_DefaultDevice.interface_name, "%s", CoreAudio_DefaultDevice.dev_name);
     
-    pthread_mutexattr_init(&mutexattr);
-    pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE);
-
     for (i = 0; i < MAX_WAVEOUTDRV; ++i)
     {
         WOutDev[i].state = WINE_WS_CLOSED;
@@ -509,10 +505,8 @@ LONG CoreAudio_WaveInit(void)
         WOutDev[i].caps.dwFormats |= WAVE_FORMAT_1M16;
         WOutDev[i].caps.dwFormats |= WAVE_FORMAT_1S16;
 
-        pthread_mutex_init(&WOutDev[i].lock, &mutexattr); /* initialize the mutex */
+        pthread_mutex_init(&WOutDev[i].lock, NULL); /* initialize the mutex */
     }
-
-    pthread_mutexattr_destroy(&mutexattr);
     
     /* create mach messages handler */
     srandomdev();


More information about the wine-patches mailing list