mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-11-29 01:04:41 +00:00
Fix multi-waiter cases for Lbq and PLT_EVENT
We don't hit the broken cases today, but we could in the future.
This commit is contained in:
1 parent
e44e4290ed
commit
eac4c469c7
3 files changed
+19
-10
No files matched your search
+14
-1
@@ -356,7 +356,7 @@ void PltSetEvent(PLT_EVENT* event) {
|
||||
PltLockMutex(&event->mutex);
|
||||
event->signalled = true;
|
||||
PltUnlockMutex(&event->mutex);
|
||||
PltSignalConditionVariable(&event->cond);
|
||||
PltBroadcastConditionVariable(&event->cond);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -423,6 +423,19 @@ void PltSignalConditionVariable(PLT_COND* cond) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void PltBroadcastConditionVariable(PLT_COND* cond) {
|
||||
#if defined(LC_WINDOWS)
|
||||
WakeAllConditionVariable(cond);
|
||||
#elif defined(__WIIU__)
|
||||
// FIXME: This only wakes one thread
|
||||
OSFastCond_Signal(cond);
|
||||
#elif defined(__3DS__)
|
||||
CondVar_Broadcast(cond);
|
||||
#else
|
||||
pthread_cond_broadcast(cond);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PltWaitForConditionVariable(PLT_COND* cond, PLT_MUTEX* mutex) {
|
||||
#if defined(LC_WINDOWS)
|
||||
SleepConditionVariableSRW(cond, mutex, INFINITE, 0);
|
||||
|
||||
Reference in new issue
Block a user