Mail Archives: cygwin-developers/1998/02/02/11:16:45
In article <199802021842 DOT NAA11902 AT subrogation DOT cygnus DOT com>,
Ian Lance Taylor <gnu-win32-developers AT cygnus DOT com> wrote:
> From: cgf AT bbc DOT com (Christopher Faylor)
> Date: Mon, 2 Feb 1998 18:36:56 GMT
>
> Could the process which has the slave open signal EOF in some other
> way, perhaps, like by releasing a mutex?
>
>Not easily. The problem is that the master will call read, which will
>turn into a call to ReadFile. That will hang reading from a pipe.
>When all instances of the write end of the pipe are closed, the read
>will return correctly.
>
>Using a mutex is hard because Windows, in its wisdom, does not permit
>asynchronous reads from a pipe. So as far as I know this would
>require creating a thread to hang reading from the pipe, and having
>the main code wait for either the thread or for the EOF mutex. It
>might be possible to make this work, but what a pain just to do a
>read. We would still have to keep track of the number of slaves ptys
>which were open, to know whether we should presume an EOF or not.
It does sound like too much bookkeeping for such a simple concept.
The other thing that I always investigate and then toss out is to use
mail slots for this type of application. I don't think mail slots are
full-featured enough either and there may be some performance concerns.
--
http://www.bbc.com/ cgf AT bbc DOT com "Strange how unreal
VMS=>UNIX Solutions Boston Business Computing the real can be."
- Raw text -