monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Help: select() like functionality on pipes on Win32


From: Christof Petig
Subject: Re: [Monotone-devel] Help: select() like functionality on pipes on Win32 - how?
Date: Mon, 18 Jul 2005 15:51:33 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050404)

Hi Jon,

do you enjoy the hot weather? (Living so close to a fellow developer is
still a strange experience to me. Couldn't resist ;-) )

>> ==> How can I wait for data to get available on a pipe on Win32? <==

(I should have added: "without already reading it")

Jon Bright schrieb:
> Did you look at
> 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/named_pipe_server_using_completion_routines.asp
> or
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/named_pipe_server_using_overlapped_i_o.asp

Thanks for the first link, I only found the second one which is much
more complicated. But ...

... both approaches use asynchronous read/write. So unless someone else
comes up with a really different idea I have to abuse the Probe::ready
function to actually read/write the data queued by the
Stream::read/write function into/from the Stream. :-(

I do not look forward to meddling the concepts of (and classes for)
select/read+write for windows compatibility only.

> Alternatively, you could just create a semaphore and use
> WaitForSingleObject, signalling readiness out-of-band?

That sounds interesting (at least I have not already known about this
approach). Is it possible to emulate (wait up to 5 seconds or until data
on fd 0 is available but do NOT already read it)
  FD_SET(0, rdfds);
  tv.tv_sec = 5;
  select(1, &rfds, NULL, NULL, &tv);
this way?

   Christof

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]