2
0
Эх сурвалжийг харах

* wait in PeekMessage if no data available immediately

git-svn-id: trunk@9138 -
Tomas Hajny 18 жил өмнө
parent
commit
3c24c6c16d

+ 7 - 1
packages/fcl-process/src/os2/simpleipc.inc

@@ -138,7 +138,8 @@ end;
 
 procedure TPipeServerComm.StopServer;
 begin
-  if (DosDisconnectNPipe (FStream.Handle) <> 0) then
+  if (DosDisconnectNPipe (FStream.Handle) <> 0) or
+                 (DosCloseEventSem (EventSem) <> 0) then
                        Owner.DoError (SErrFailedToDisconnectPipe, [FFileName]);
   FreeAndNil (FStream);
 end;
@@ -151,6 +152,11 @@ begin
   Result := (DosQueryNPipeSemState (EventSem, PipeSemState,
              SizeOf (PipeSemState)) = 0) and (PipeSemState.Status = 1) and
                 (PipeSemState.Avail <> 0) and (PipeSemState.Key = PipeKey);
+  if not (Result) then
+    Result := (DosWaitEventSem (EventSem, TimeOut) = 0) and
+               (DosQueryNPipeSemState (EventSem, PipeSemState,
+                SizeOf (PipeSemState)) = 0) and (PipeSemState.Status = 1) and
+                    (PipeSemState.Avail <> 0) and (PipeSemState.Key = PipeKey);
 end;