This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Using alarm
- To: Ho Shui Choy Stanley NCS <scho at ncs dot com dot sg>
- Subject: Re: [ECOS] Using alarm
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- Date: Fri, 3 Aug 2001 09:18:42 +0200
- Cc: "Ecos-Discuss (E-mail)" <ecos-discuss at sources dot redhat dot com>
- References: <19C34CD863B1D4118E2800508BAF663A0112F684@STONE>
On Fri, Aug 03, 2001 at 11:20:41AM +0800, Ho Shui Choy Stanley NCS wrote:
> Hi
> The program hangs when the alarm triggers for the first time and stops in
> the alarm function at the while loop.
> Can anyone please advice on what is the cause?
Alarm handlers run in something like a DSR. That means you cannot call
functions that could block. In your example you do reads on an IO
device. This is probably blocking, which is fatal. Instead your alarm
handler should post on a semaphore to wake up a thread to do the work.
Andrew