From 868cffd793d6f7e03882051af45aef0a9edd05d1 Mon Sep 17 00:00:00 2001
From: adjonesey <adjones3y@gmail.com>
Date: Thu, 19 Sep 2024 05:15:42 +0100
Subject: [PATCH] Fix Regression #932 (#973)

---
 src/core/libraries/kernel/threads/semaphore.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/core/libraries/kernel/threads/semaphore.cpp b/src/core/libraries/kernel/threads/semaphore.cpp
index 312f82b6..ff536802 100644
--- a/src/core/libraries/kernel/threads/semaphore.cpp
+++ b/src/core/libraries/kernel/threads/semaphore.cpp
@@ -32,6 +32,10 @@ public:
             return ORBIS_KERNEL_ERROR_EBUSY;
         }
 
+        if (timeout && *timeout == 0) {
+            return SCE_KERNEL_ERROR_ETIMEDOUT;
+        }
+
         // Create waiting thread object and add it into the list of waiters.
         WaitingThread waiter{need_count, is_fifo};
         const auto it = AddWaiter(&waiter);