Vincent Snijders wrote:
Marc Weustink wrote:

Vincent Snijders wrote:

Micha Nelissen wrote:

On Tue, 30 Aug 2005 11:09:30 +0200 (Romance Daylight Time)
Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

In windows, it's slightly more difficult (surprise, surprise :-) )

You can use MsgWaitForMultipleObjects to do this for a windows
handle, or use WaitForSingleObject on a simple file handle.





You can't "wait" for file handles in windows.

AFAIK you can wait for file handles, but not for pipe handles.



AFAIK we wait here for pipehandles all the time


And how are you doing that?

In lazarus the following code is used (more or less):
repeat
  Windows.PeekNamedPipe(PipeHnd, nil, 0, nil, @TotalBytesAvailable, nil);
  if TotalBytesAvailable>0 then break;
  Application.ProcessMessages
  Sleep(10);
until false;

IMHO, that is not really waiting.

Nope.

I dived a bit into it, it is not really my code. I think you create a wait with the following concept, using overlapped IO

Use ReadFileEx(hPipe, buf, nNumberOfBytesToRead, lpOverlapped, lpCompletionRoutine) to read from the pipe.
Then call MsgWaitForMultipleObjectEx to enter an alertable wait state
In the lpCompletionRoutine you can set an event to signal that the pipe read is finished.

Hmm... now I notice that this is NT+ only :(

Marc

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to