From 694341aa789e1bc5d3653e5a816cf102179ab554 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Sun, 4 Aug 2024 00:35:17 +0300 Subject: [PATCH] * WebAssembly threads: fixed bug in LockMutexTimeoutNoWait, caused by the use of Result instead of Res. This stupid bug broke WebAssembly critical sections, causing random spurious hangs and it took me quite a lot of time to find it! --- rtl/wasi/wasmmutex.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtl/wasi/wasmmutex.inc b/rtl/wasi/wasmmutex.inc index a3043b4c64..6420743507 100644 --- a/rtl/wasi/wasmmutex.inc +++ b/rtl/wasi/wasmmutex.inc @@ -84,7 +84,7 @@ begin {$IFDEF DEBUGWASMTHREADS}DebugWriteln('LockMutexTimeoutNoWait: entering loop');{$ENDIF} Repeat if TryLockMutex(M) then - Result:=lmrOK + Res:=lmrOK else if (GetThreadState(MyThread)<>tsRunning) then Res:=lmrError else if (aTimeOutNS>=0) and (GetClockTime>EndTime) then