mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-23 20:00:03 +01:00
WaitForHandles rewritten using PeekNamedPipe
git-svn-id: trunk@5284 -
This commit is contained in:
parent
78458b19b4
commit
e443567c80
@ -172,6 +172,46 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$ELSE linux}
|
{$ELSE linux}
|
||||||
{$IFDEF WIN32}
|
{$IFDEF WIN32}
|
||||||
|
{$IFDEF DebuggerUsePeekNamedPipe}
|
||||||
|
var
|
||||||
|
Count: Integer;
|
||||||
|
PipeHandle: Integer;
|
||||||
|
BytesRead: integer;
|
||||||
|
TotalBytesAvailable: integer;
|
||||||
|
R: LongBool;
|
||||||
|
n: integer;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
while Result=0 do
|
||||||
|
begin
|
||||||
|
for n:= 0 to High(AHandles) do
|
||||||
|
begin
|
||||||
|
PipeHandle := AHandles[n];
|
||||||
|
R := Windows.PeekNamedPipe(PipeHandle, null, 0, 0, @TotalBytesAvailable, null);
|
||||||
|
writeln('PeekNamedPipe returned with ',R);
|
||||||
|
if not R then begin
|
||||||
|
// PeekNamedPipe failed
|
||||||
|
Writeln('GetLastError is ', GetLastError);
|
||||||
|
Continue;
|
||||||
|
end;
|
||||||
|
if R then begin
|
||||||
|
// PeekNamedPipe successfull
|
||||||
|
writeln('TotalBytesAvailable: ', TotalBytesAvailable);
|
||||||
|
if (TotalBytesAvailable>0) then begin
|
||||||
|
Result := 1 shl n;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
// process messages
|
||||||
|
Application.ProcessMessages;
|
||||||
|
if Application.Terminated then Break;
|
||||||
|
// sleep a bit
|
||||||
|
Sleep(10);
|
||||||
|
end;
|
||||||
|
writeln('[WaitForHandles returns ', Result);
|
||||||
|
{$ELSE DebuggerUsePeekNamedPipe}
|
||||||
var
|
var
|
||||||
Count: Integer;
|
Count: Integer;
|
||||||
TimeOut: Integer;
|
TimeOut: Integer;
|
||||||
@ -179,7 +219,7 @@ var
|
|||||||
P: Pointer;
|
P: Pointer;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
Count := High(AHandles);
|
Count := High(AHandles)+1;
|
||||||
if Count < 0 then Exit;
|
if Count < 0 then Exit;
|
||||||
if Count > 31 then Count := 31;
|
if Count > 31 then Count := 31;
|
||||||
// I know MAXIMUM_WAIT_OBJECTS is 64, but that wont fit in an int :)
|
// I know MAXIMUM_WAIT_OBJECTS is 64, but that wont fit in an int :)
|
||||||
@ -211,7 +251,7 @@ begin
|
|||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF DebuggerUsePeekNamedPipe}
|
||||||
{$ELSE win32}
|
{$ELSE win32}
|
||||||
begin
|
begin
|
||||||
writeln('ToDo: implement WaitForHandles for this OS');
|
writeln('ToDo: implement WaitForHandles for this OS');
|
||||||
@ -405,6 +445,7 @@ begin
|
|||||||
if FFlushAfterRead
|
if FFlushAfterRead
|
||||||
then FOutputBuf := '';
|
then FOutputBuf := '';
|
||||||
FFlushAfterRead := False;
|
FFlushAfterRead := False;
|
||||||
|
writeln('TCmdLineDebugger.ReadLine returns ', result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCmdLineDebugger.SendCmdLn(const ACommand: String); overload;
|
procedure TCmdLineDebugger.SendCmdLn(const ACommand: String); overload;
|
||||||
@ -437,6 +478,9 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.29 2004/03/07 21:05:29 vincents
|
||||||
|
WaitForHandles rewritten using PeekNamedPipe
|
||||||
|
|
||||||
Revision 1.28 2004/02/12 01:09:42 marc
|
Revision 1.28 2004/02/12 01:09:42 marc
|
||||||
+ added the first conceptual code for WaitForHandles on Win32
|
+ added the first conceptual code for WaitForHandles on Win32
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user