DataWaiting function
This commit is contained in:
parent
5c90d03dd2
commit
eec7002fe0
|
@ -28,6 +28,7 @@ Type
|
|||
Procedure SendToPipe (Var Buf; Len: Longint);
|
||||
Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord);
|
||||
Procedure Disconnect;
|
||||
Function DataWaiting : Boolean;
|
||||
End;
|
||||
|
||||
Implementation
|
||||
|
@ -47,6 +48,20 @@ Begin
|
|||
Inherited Destroy;
|
||||
End;
|
||||
|
||||
Function TPipeUnix.DataWaiting : Boolean;
|
||||
Var
|
||||
FDSin : TFDSet;
|
||||
Begin
|
||||
Result := False;
|
||||
|
||||
If PipeHandle = -1 Then Exit;
|
||||
|
||||
fpFD_Zero (FDSIN);
|
||||
fpFD_Set (PipeHandle, FDSIN);
|
||||
|
||||
Result := fpSelect(PipeHandle + 1, @FDSIN, NIL, NIL, 0) > 0;
|
||||
End;
|
||||
|
||||
Function TPipeUnix.CreatePipe : Boolean;
|
||||
Var
|
||||
PipeName : String;
|
||||
|
|
|
@ -31,6 +31,7 @@ Type
|
|||
Procedure SendToPipe (Var Buf; Len: Longint);
|
||||
Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord);
|
||||
Procedure Disconnect;
|
||||
Function DataWaiting : Boolean;
|
||||
End;
|
||||
|
||||
Implementation
|
||||
|
@ -50,6 +51,25 @@ Begin
|
|||
Inherited Destroy;
|
||||
End;
|
||||
|
||||
Function TPipeWindows.DataWaiting : Boolean;
|
||||
Var
|
||||
Temp : LongWord;
|
||||
Avail : LongWord;
|
||||
Begin
|
||||
Result := False;
|
||||
|
||||
If PipeHandle = -1 Then Exit;
|
||||
|
||||
PeekNamedPipe (PipeHandle,
|
||||
NIL,
|
||||
Temp,
|
||||
NIL,
|
||||
@Avail,
|
||||
NIL);
|
||||
|
||||
Result := (Avail > 0);
|
||||
End;
|
||||
|
||||
Function TPipeWindows.CreatePipe : Boolean;
|
||||
Var
|
||||
SecAttr : TSecurityAttributes;
|
||||
|
|
Loading…
Reference in New Issue