Browse Source

* WebAssembly threads: reformat code in LockMutexTimeoutNoWait for better
readability by removing begin..end blocks and replacing it with an 'else if'
chain. No functional changes.

Nikolay Nikolov 1 year ago
parent
commit
c2fcb1a833
1 changed files with 4 additions and 10 deletions
  1. 4 10
      rtl/wasi/wasmmutex.inc

+ 4 - 10
rtl/wasi/wasmmutex.inc

@@ -85,16 +85,10 @@ begin
   Repeat
     if TryLockMutex(M) then
       Result:=lmrOK
-    else
-      begin
-      If (GetThreadState(MyThread)<>tsRunning) then
-        Res:=lmrError
-      else
-        begin
-        If (aTimeOutNS>=0) and (GetClockTime>EndTime) then
-          Res:=lmrTimeOut
-        end;
-      end;
+    else if (GetThreadState(MyThread)<>tsRunning) then
+      Res:=lmrError
+    else if (aTimeOutNS>=0) and (GetClockTime>EndTime) then
+      Res:=lmrTimeOut;
   Until (res<>lmrNone);
   {$IFDEF DEBUGWASMTHREADS}DebugWriteln('LockMutexTimeoutNoWait: done loop');{$ENDIF}
   LockMutexTimeoutNoWait:=Res;