This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: select err in ecos application
- To: ecos-discuss at sources dot redhat dot com
- Subject: Re: [ECOS] select err in ecos application
- From: Nick Garnett <nickg at redhat dot com>
- Date: 09 Jul 2001 11:08:53 +0100
- Newsgroups: cygnus.sourceware.ecos.d
- Organization: Red Hat UK
- References: <001201c1078b$b7d93ac0$592da8c0@start.com.cn>
"wangwei" <wangw@start.com.cn> writes:
> Hi all:
>
> I'm making a application in ecos , which will drive 8 serial ports and
> tcp/ip.
> I use function "select" in my program .To improve speed , I use ISR of
> serial port
> to receive data , not DSR. So the functon "cyg_selwakeup" is called in ISR .
You just cannot do that. There is no guarantee that the state of the
kernel run queues, the condition variable or the mutex involved will
be consistent. Applying any operation to them in an ISR is very
likely to corrupt something. Which is exactly what is happening to
you.
Instead, you should move the call to cyg_selwakeup() to the DSR and
have the ISR return the RUN_DSR bit only when it needs to be called.
--
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK