DataWaiting function
This commit is contained in:
parent
5c90d03dd2
commit
eec7002fe0
|
@ -28,6 +28,7 @@ Type
|
||||||
Procedure SendToPipe (Var Buf; Len: Longint);
|
Procedure SendToPipe (Var Buf; Len: Longint);
|
||||||
Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord);
|
Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord);
|
||||||
Procedure Disconnect;
|
Procedure Disconnect;
|
||||||
|
Function DataWaiting : Boolean;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
@ -47,6 +48,20 @@ Begin
|
||||||
Inherited Destroy;
|
Inherited Destroy;
|
||||||
End;
|
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;
|
Function TPipeUnix.CreatePipe : Boolean;
|
||||||
Var
|
Var
|
||||||
PipeName : String;
|
PipeName : String;
|
||||||
|
|
|
@ -31,6 +31,7 @@ Type
|
||||||
Procedure SendToPipe (Var Buf; Len: Longint);
|
Procedure SendToPipe (Var Buf; Len: Longint);
|
||||||
Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord);
|
Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord);
|
||||||
Procedure Disconnect;
|
Procedure Disconnect;
|
||||||
|
Function DataWaiting : Boolean;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
@ -50,6 +51,25 @@ Begin
|
||||||
Inherited Destroy;
|
Inherited Destroy;
|
||||||
End;
|
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;
|
Function TPipeWindows.CreatePipe : Boolean;
|
||||||
Var
|
Var
|
||||||
SecAttr : TSecurityAttributes;
|
SecAttr : TSecurityAttributes;
|
||||||
|
|
Loading…
Reference in New Issue