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]
Other format: [Raw text]

Re: timed restart of a thread from within a thread


"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


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