Bug 57140

Summary: fflush can be simplified
Product: [Retired] eCos Reporter: Jonathan Larmour <jlarmour>
Component: C libraryAssignee: Jonathan Larmour <jlarmour>
Status: CLOSED WONTFIX QA Contact: Jonathan Larmour <jlarmour>
Severity: medium Docs Contact:
Priority: medium    
Version: CVS   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-06-20 16:07:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathan Larmour 2001-12-05 18:21:43 UTC
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[1] 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.

Comment 1 Alex Schuilenburg 2003-06-20 16:07:03 UTC
This bug has moved to http://bugs.ecos.sourceware.org/show_bug.cgi?id=57140