This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: timed restart of a thread from within a thread
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: "Aaron Case" <aaron dot case at dynazign dot com>
- Cc: <ecos-discuss at sources dot redhat dot com>
- Date: 01 Aug 2003 18:29:19 +0100
- Subject: Re: [ECOS] timed restart of a thread from within a thread
- References: <GBEOKKOEOGFDMKDFCHIMAECKCAAA.aaron.case@dynazign.com>
"Aaron Case" <aaron.case@dynazign.com> writes:
>
> The MTOS call, ENDR, is called within the task, the task is removed from the
> scheduler, and restarted after a given amount of time specified to the ENDR
> call.
>
When a thread calls cyg_thread_exit() it goes in to a limbo state. It
will only really go away when some other thread calls
cyg_thread_delete() on it. A call to cyg_thread_resume() while the
thread is in limbo will cause it to restart from its entry function.
So all you need to do to get what you want is for the thread to set up
an alarm for the desired wakeup time and then call
cyg_thread_exit(). When the alarm goes off, you can just call
cyg_thread_resume() in the alarm action function and the thread will
restart.
--
Nick Garnett eCos Kernel 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