Marcus Brinkmann <[EMAIL PROTECTED]> writes:

> On Wed, Jan 30, 2002 at 02:52:30PM -0800, Thomas Bushnell, BSG wrote:
> > The Right Thing is surely two separate threads.  I'm not sure that
> > select is really necessary at all however.  
> 
> I have stumbled upon an obscure race where it helps.  I am not sure if
> it is worth the use of io_select, I will leave this for you to decide.

A race should always be avoided if it makes a bug.  But there may be a
way to avoid it without select.

> The issue I am talking about is implementing pending_output_size correctly,
> which should return the number of bytes pending for output.  The problem
> exists only for ioports that have the tiocoutq capability.  Because we don't
> know if the underlying translator already has received the io_write or not,
> we don't know what the correct return value is:

pending_output_size is always approximate.  Users cannot rely on it
being totally synchronized.  The situation you describe here occurs
for almost all serial hardware in existence, and it's not a reason to
worry about anything else.  So this case is a sort of race, but it's
not a bug, because we don't actually need to worry about the exact
value. 

> Now, after the signature, an excerpt from the current implementation of the
> writer loop.  What do you think?

Looks reasonable to me.  I assume that this function is the only one
that mucks with the pending_output array?


_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd

Reply via email to