This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: Race conditions in serial_select
- From: Andrew Lunn <andrew at lunn dot ch>
- To: "Gaer, A." <Andreas dot Gaer at baslerweb dot com>
- Cc: ecos-patches at ecos dot sourceware dot org
- Date: Mon, 20 Jun 2005 20:15:18 +0200
- Subject: Re: Race conditions in serial_select
- References: <850597605E79D21182830008C7A4B9CF36159B6B@localhost>
On Fri, Jun 17, 2005 at 11:47:09AM +0200, Gaer, A. wrote:
> Hello all!
>
> The serial_select() implementation from
> "io/serial/current/src/common/serial.c" doesn't care about concurrent access
> to the cbuf structure. This leads to race conditions when the serial DSR
> routine changes the counters in this structure while select checks for
> "cbuf->nb == 0". As a result, user threads that sleep because of a select
> call will not be woken up, even if data arrives. Also access to this
> structure isn't implemented thread-safe because of missing mutex locks. The
> attached patch fixes this problems.
Thanks
Andrew