mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-17 08:55:48 +00:00
Change PltWaitForEvent to void return type
This commit is contained in:
parent
61b4fc1fe7
commit
71a267fd28
@ -204,7 +204,6 @@ int LbqPollQueueElement(PLINKED_BLOCKING_QUEUE queueHead, void** data) {
|
||||
|
||||
int LbqWaitForQueueElement(PLINKED_BLOCKING_QUEUE queueHead, void** data) {
|
||||
PLINKED_BLOCKING_QUEUE_ENTRY entry;
|
||||
int err;
|
||||
|
||||
if (queueHead->shutdown) {
|
||||
return LBQ_INTERRUPTED;
|
||||
@ -217,10 +216,7 @@ int LbqWaitForQueueElement(PLINKED_BLOCKING_QUEUE queueHead, void** data) {
|
||||
//
|
||||
// If we're draining, we will never wait on the queue.
|
||||
if (queueHead->head == NULL && !queueHead->draining) {
|
||||
err = PltWaitForEvent(&queueHead->containsDataEvent);
|
||||
if (err != PLT_WAIT_SUCCESS) {
|
||||
return LBQ_INTERRUPTED;
|
||||
}
|
||||
PltWaitForEvent(&queueHead->containsDataEvent);
|
||||
}
|
||||
|
||||
PltLockMutex(&queueHead->mutex);
|
||||
|
@ -329,25 +329,15 @@ void PltClearEvent(PLT_EVENT* event) {
|
||||
#endif
|
||||
}
|
||||
|
||||
int PltWaitForEvent(PLT_EVENT* event) {
|
||||
void PltWaitForEvent(PLT_EVENT* event) {
|
||||
#if defined(LC_WINDOWS)
|
||||
DWORD error;
|
||||
|
||||
error = WaitForSingleObjectEx(*event, INFINITE, FALSE);
|
||||
if (error == WAIT_OBJECT_0) {
|
||||
return PLT_WAIT_SUCCESS;
|
||||
}
|
||||
else {
|
||||
LC_ASSERT(false);
|
||||
return -1;
|
||||
}
|
||||
WaitForSingleObjectEx(*event, INFINITE, FALSE);
|
||||
#else
|
||||
PltLockMutex(&event->mutex);
|
||||
while (!event->signalled) {
|
||||
PltWaitForConditionVariable(&event->cond, &event->mutex);
|
||||
}
|
||||
PltUnlockMutex(&event->mutex);
|
||||
return PLT_WAIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -64,15 +64,12 @@ int PltCreateEvent(PLT_EVENT* event);
|
||||
void PltCloseEvent(PLT_EVENT* event);
|
||||
void PltSetEvent(PLT_EVENT* event);
|
||||
void PltClearEvent(PLT_EVENT* event);
|
||||
int PltWaitForEvent(PLT_EVENT* event);
|
||||
void PltWaitForEvent(PLT_EVENT* event);
|
||||
|
||||
int PltCreateConditionVariable(PLT_COND* cond, PLT_MUTEX* mutex);
|
||||
void PltDeleteConditionVariable(PLT_COND* cond);
|
||||
void PltSignalConditionVariable(PLT_COND* cond);
|
||||
void PltWaitForConditionVariable(PLT_COND* cond, PLT_MUTEX* mutex);
|
||||
|
||||
#define PLT_WAIT_SUCCESS 0
|
||||
#define PLT_WAIT_INTERRUPTED 1
|
||||
|
||||
void PltSleepMs(int ms);
|
||||
void PltSleepMsInterruptible(PLT_THREAD* thread, int ms);
|
||||
|
Loading…
x
Reference in New Issue
Block a user