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: "'eCos discussion'" <ecos-discuss at sources dot redhat dot com>
- Subject: Re: [ECOS] Idle thread trying to sleep
- From: Hugo Tyson <hmt at redhat dot com>
- Date: 06 Jul 2001 16:37:40 +0100
- References: <000f01c10630$34cfe040$090110ac@TRENT>
- Reply-To: "'eCos discussion'" <ecos-discuss at sources dot redhat dot com>
"Trenton D. Adams" <tadams@extremeeng.com> writes:
> 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
Correct, you cannot.
> () function? How am I supposed to know that I'm delaying the right
> amount of time if I can't use cyg_thread_delay ()?
The uS delay function in the HAL and hal_if.h - it busy-waits, very
inefficient and all that. That the unit is uS is a hint about how it's
appropriate to be used. ;-)
But more importantly, if you have to delay 300mS (one third of a second!)
you utterly should not do this within a DSR! Use the DSR to awaken a high
priority thread, and have that do the work and the cyg_thread_delay() and
so on. That's what DSRs and threads are for.
For one thing, looping in a DSR will cause you to lose 30 clock ticks,
because you'll block the system from running any other DSRs for all that
time.
HTH,
- Huge