diff options
Diffstat (limited to 'zencore/thread.cpp')
| -rw-r--r-- | zencore/thread.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/zencore/thread.cpp b/zencore/thread.cpp index 78238a3d5..981d2bd96 100644 --- a/zencore/thread.cpp +++ b/zencore/thread.cpp @@ -236,12 +236,12 @@ Event::Wait(int TimeoutMs) ////////////////////////////////////////////////////////////////////////// #if ZEN_PLATFORM_LINUX -static bool IsThereAMessageInQueue(int Fd) +static bool IsMessageQueueEmpty(int Fd) { // Check if there is already a message in the queue. mq_attr Attributes = { O_NONBLOCK, 1, 1, 0 }; mq_getattr(Fd, &Attributes); - return (Attributes.mq_curmsgs > 0); + return (Attributes.mq_curmsgs == 0); } #endif // ZEN_PLATFORM_LINUX @@ -278,7 +278,7 @@ NamedEvent::NamedEvent(std::string_view EventName) int LockResult = flock(Inner, LOCK_EX|LOCK_NB); if (LockResult == 0) { - ZEN_ASSERT( IsThereAMessageInQueue(Inner) == false, + ZEN_ASSERT( IsMessageQueueEmpty(Inner), "Ownership of a non-empty '{}' message queue occurred", Name.c_str()); } @@ -325,7 +325,7 @@ void NamedEvent::Set() #elif ZEN_PLATFORM_LINUX int Inner = int(intptr_t(m_EventHandle)); - if (IsThereAMessageInQueue(Inner)) + if (!IsMessageQueueEmpty(Inner)) { return; } @@ -355,7 +355,7 @@ bool NamedEvent::Wait(int TimeoutMs) #elif ZEN_PLATFORM_LINUX int Inner = int(intptr_t(m_EventHandle)); - if (IsThereAMessageInQueue(Inner)) + if (!IsMessageQueueEmpty(Inner)) { return true; } |