mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 09:25:49 +00:00
Fix mutexes on Windows and Windows Phone
This commit is contained in:
parent
30f275768c
commit
75c80347a7
@ -51,7 +51,7 @@ void PltSleepMs(int ms) {
|
|||||||
|
|
||||||
int PltCreateMutex(PLT_MUTEX *mutex) {
|
int PltCreateMutex(PLT_MUTEX *mutex) {
|
||||||
#if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE)
|
#if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE)
|
||||||
*mutex = CreateMutexEx(NULL, NULL, 0, 0);
|
*mutex = CreateMutexEx(NULL, NULL, 0, MUTEX_ALL_ACCESS);
|
||||||
if (!*mutex) {
|
if (!*mutex) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -71,7 +71,11 @@ void PltDeleteMutex(PLT_MUTEX *mutex) {
|
|||||||
|
|
||||||
void PltLockMutex(PLT_MUTEX *mutex) {
|
void PltLockMutex(PLT_MUTEX *mutex) {
|
||||||
#if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE)
|
#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
|
#else
|
||||||
pthread_mutex_lock(mutex);
|
pthread_mutex_lock(mutex);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user