> On Mon, Oct 29, 2001 at 02:08:23PM -0000, Simon Marlow wrote:
> > This appears to be because the dummy Handle opened in 
> WriteMode is being
> > garbage collected and closed, which leaves the FIFO with no 
> writers so
> > you get EOF.  5.02 is behaving correctly here.  You can add an extra
> > 'hClose dummy' at the end of 'main' to prevent the EOF exception.
> 
> Argh, that was exactly what I feared when I read the file-handles
> discussion on the list. Only I didn't realize that the feature
> got indeed introduced into ghc-5.02.

Just to clarify: this isn't really new behaviour, but there might be a
difference in the timing of GC and the scheduling of finalizers which
means the observable behaviour between 5.02 and 5.00.2 is different.  Of
course, there might also have been a bug in 5.00.2's IO implementation.

> > You have some extra blocking in there: just comment out the 
> first two
> > lines  of fifoReadLoop, and everything should be fine.  
> This also fixes
> > the other problem you mentioned above ("varying numbers of last").
> 
> The blocking is essential since I need to be able to use MVars
> between the threadWaitRead & the hGetLine (remember the note I
> sent about fork()ing).

Sorry, I can't remember that - could you remind me?  The hGetLine
already blocks if there's no data in the FIFO, the extra threadWaitRead
will only work if the Handle is in NoBuffering mode, because otherwise
there might be data in the handle buffer waiting to be read which
threadWaitRead would be unable to detect.

Cheers,
        Simon

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to