Red Hat Bugzilla – Bug 57140
fflush can be simplified
Last modified: 2007-04-18 12:38:35 EDT
Description of Problem:
From the thread "Fix fflush starvation [#57014]" on ecc-target-changes:
> But I don't see how your change manages this at all. It seems to me
> that if you enter this [loop] with some other thread holding the lock,
> you'll try once and fail and then immediately just do the
> lock-with-wait. Or, am I missing something?
The idea was that you may go enter this loop with a stream already locked,
and someone else may do the same, resulting in a potential deadlock.
However, I've just noticed that this is a difference between my code and
the pthread code. In my code Cyg_StdioStream::refill_read_buffer will
already have flushed the stream, whereas in the pthread code, the code in
question deals with all the streams (including the one already locked).
I'll open a bugzilla bug, as I'm not sure exactly what would happen with
!CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO. Right now it would break, but flushing
should be mostly a nop anyway. At the very least, flush_output_unlocked
should call cyg_stdio_flush in that case which it doesn't.
This bug has moved to http://bugs.ecos.sourceware.org/show_bug.cgi?id=57140