From dbd7cfa7f406334e80ef80ddd962d5619b045ff9 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Thu, 14 Aug 2025 18:40:01 +0200 Subject: Improved Thread/Semaphore/Event timeout handling (new default: return immediately instead of waiting indefinitely) Signed-off-by: Toni Uhlig --- CRT/DriverThread.cpp | 8 +++++--- CRT/DriverThread.hpp | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CRT/DriverThread.cpp b/CRT/DriverThread.cpp index 3a77dc8..557b270 100644 --- a/CRT/DriverThread.cpp +++ b/CRT/DriverThread.cpp @@ -56,6 +56,7 @@ NTSTATUS DriverThread::Thread::Start(ThreadRoutine routine, eastl::shared_ptr args); - NTSTATUS WaitForTermination(LONGLONG timeout = 0); + NTSTATUS WaitForTermination(LONGLONG timeout = -1); HANDLE GetThreadId(void) { return m_threadId; @@ -94,7 +94,7 @@ class Semaphore { public: Semaphore(LONG initialValue = 0, LONG maxValue = MAXLONG); - NTSTATUS Wait(LONGLONG timeout = 0); + NTSTATUS Wait(LONGLONG timeout = -1); LONG Release(LONG adjustment = 1); private: @@ -105,7 +105,7 @@ class Event { public: Event(); - NTSTATUS Wait(LONGLONG timeout = 0); + NTSTATUS Wait(LONGLONG timeout = -1); NTSTATUS Notify(); private: -- cgit v1.2.3