AW: [En-Nut-Discussion] fflush on input

Oliver Schulz Oliver.Schulz at bong.de
Fri Feb 27 10:04:33 CET 2004


Hi,

to finally clearify this fflush issue:

By calling 'fflush', the device's write function is called with parameter 'len' set to zero. It's up to the device driver to handle this special write.

The USART device driver and TCPSOCKET virtual device will then sent any buffered output data to the device output function. That means output buffers are flushed, but NOT discarded.

The input buffer is NOT touched in any manner, means that it is also NOT discarded.

Actually there is no function to discard input buffers, but IMHO it would be nice to have one. I will look how to implement 'fpurge' this weekend (and commitin' some other queued bugfixes to CVS).

Regards,
Oliver.


> -----Ursprüngliche Nachricht-----
> Von: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de]Im Auftrag von 
> Pavel Chromy
> Gesendet: Freitag, 27. Februar 2004 09:35
> An: Ethernut User Chat (English)
> Betreff: Re: [En-Nut-Discussion] fflush on input
> 
> 
> 
> > I use fflush to ensure the output goes to destination but I 
> wouldnt want 
> > to lose incoming data already queued just because the output thread 
> > wanted to hurry up....  How should I be forcing output 
> buffer to flush 
> > without affecting incoming stream data?
> 
> > Message: 4
> > Date: Thu, 11 Dec 2003 15:08:28 +0100
> > From: Harald Kipp <harald.kipp at egnite.de>
> > Subject: Re: [En-Nut-Discussion] fflush newbie question
> > To: togrady at comtech.uk.com,	"Ethernut User Chat (English)"
> > 	<en-nut-discussion at egnite.de>
> > Message-ID: <5.1.1.6.0.20031211150609.02d48d18 at egnite.de>
> > Content-Type: text/plain; charset="us-ascii"; format=flowed
> > 
> > fflush forces data output only. It does not flush the input
> > buffer, which is considered an error and will be changed.
> > 
> > fflush shall force output and discard the input.
> 
> I bit outdated reply:
> I think this that discarding output in fflush is a bad idea
> as Brett pointed out.
> There might be a separate function discarding input, which is 
> usually called
> purge (probably fpurge?).
> 
> Pavel
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
> 



More information about the En-Nut-Discussion mailing list