This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: periodic threads with kapi?
- From: Bart Veer <bartv at ecoscentric dot com>
- To: icanoop at bitwiser dot org
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Sun, 17 Aug 2003 19:43:16 +0100 (BST)
- Subject: Re: [ECOS] periodic threads with kapi?
- References: <20030817140013.GA27112@bitwiser.org>
>>>>> "Ryan" == Ryan Boder <icanoop@bitwiser.org> writes:
Ryan> Is there a clean way to do periodic threads with absolute
Ryan> timing, as opposed to the relative timing you get with
Ryan> cyg_thread_delay()?
This should be easy enough using something like:
void
my_thread_delay_absolute(cyg_tick_count_t abs_time)
{
cyg_tick_count_t delay = abs_time - cyg_current_time();
if (delay > 0) {
cyg_thread_delay(delay);
}
}
There is a possible problem if the current thread gets descheduled
between the cyg_current_time() and cyg_thread_delay() calls, causing
the thread to get delayed for longer than intended. You could avoid
that by e.g. temporarily boosting the current thread's priority.
Bart
--
Bart Veer eCos Configuration Architect
http://www.ecoscentric.com/ The eCos and RedBoot experts
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss