Explorar o código

AThreads: prevent deadlock for event set before waited

Marcus Sackrow %!s(int64=3) %!d(string=hai) anos
pai
achega
638de87a5a
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      rtl/amicommon/athreads.pp

+ 2 - 0
rtl/amicommon/athreads.pp

@@ -1133,6 +1133,7 @@ begin
       {$IFDEF DEBUG_AMIEVENT}
       SysDebugLn('AmiEvent: WaitFor Early Destroy');
       {$ENDIF}
+      ReleaseSemaphore(@AmiEvent^.Sem);
       Exit;
     end;
     if AmiEvent^.IsSet then
@@ -1143,6 +1144,7 @@ begin
       {$IFDEF DEBUG_AMIEVENT}
       SysDebugLn('AmiEvent: WaitFor Early Signaled');
       {$ENDIF}
+      ReleaseSemaphore(@AmiEvent^.Sem);
       Exit;
     end;
     // signal not set, so we add this call to the waiterlist