From 75c80347a74d58d9e15824b20a4263766f336506 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 2 Feb 2014 05:46:11 -0500 Subject: [PATCH] Fix mutexes on Windows and Windows Phone --- limelight-common/PlatformThreads.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/limelight-common/PlatformThreads.c b/limelight-common/PlatformThreads.c index 4a1450d..012ec9d 100644 --- a/limelight-common/PlatformThreads.c +++ b/limelight-common/PlatformThreads.c @@ -51,7 +51,7 @@ void PltSleepMs(int ms) { int PltCreateMutex(PLT_MUTEX *mutex) { #if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE) - *mutex = CreateMutexEx(NULL, NULL, 0, 0); + *mutex = CreateMutexEx(NULL, NULL, 0, MUTEX_ALL_ACCESS); if (!*mutex) { return -1; } @@ -71,7 +71,11 @@ void PltDeleteMutex(PLT_MUTEX *mutex) { void PltLockMutex(PLT_MUTEX *mutex) { #if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE) - WaitForSingleObjectEx(*mutex, INFINITE, FALSE); + int err; + err = WaitForSingleObjectEx(*mutex, INFINITE, FALSE); + if (err != WAIT_OBJECT_0) { + LC_ASSERT(FALSE); + } #else pthread_mutex_lock(mutex); #endif