This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Idle thread trying to sleep



"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]