Browse Source

* WebAssembly threads: set M.Locked to 0 on UnLockMutex

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

+ 4 - 1
rtl/wasi/wasmmutex.inc

@@ -175,7 +175,10 @@ begin
     if (MutexKind(M)=mkRecursive) or (M.Count=1) then
       InterLockedDecrement(M.Count);
     if (M.Count=0) then
-      a:=fpc_wasm32_memory_atomic_notify(@M.Locked,1);
+      begin
+        M.Locked:=0;
+        a:=fpc_wasm32_memory_atomic_notify(@M.Locked,1);
+      end;
     end;
 end;