This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: Idle thread trying to sleep
- To: "Trenton D. Adams" <tadams at extremeeng dot com>
- Subject: RE: [ECOS] Idle thread trying to sleep
- From: Gary Thomas <gthomas at redhat dot com>
- Date: Fri, 06 Jul 2001 09:41:28 -0600 (MDT)
- Cc: eCos discussion <ecos-discuss at sources dot redhat dot com>
- Organization: Red Hat, Inc.
On 06-Jul-2001 Trenton D. Adams wrote:
> This is what I'm doing. I'm trying to delay 300ms inside a function.
> This function is called in response to an interrupt. Can I not delay
> from within a DSR? How would I delay without using the cyg_thread_delay
> () function? How am I supposed to know that I'm delaying the right
> amount of time if I can't use cyg_thread_delay ()?
You can't do anything which blocks, including sleeping, in a DSR since
DSRs are run anonymously.
The way to solve this is to have your DSR control a separate thread which
can sleep, etc.
Look at the CF ethernet code for an example. There is a separate thread
which is used to handle card events. When a card is inserted, the DSR
will cause the thread to run. That thread can then do things like enable
power, etc, which must be sequenced.
Note: it might be nice to have this sort of functionality as part of the
generic CF/PCMCIA support, but at the current time it is associated with
the specific card driver.