[ECOS] RE: Periodic execution of code in a thread context

Steven Clugston steven.clugston@newcastle.ac.uk
Wed Sep 23 16:01:00 GMT 2009

>> The other way I've tried is to use a timer/alarm attached to the system
>> clock, but this executes in a DSR context which causes some limitations
>> and I would prefer to use a normal thread context.
>> Could I use a cyg_thread_suspend() at the end of each iteration then
>> re-wake the thread from an alarm handler?
>> Is there anything which I've missed like a scheduler policy or API call
>> which might help?

> I suggest you post on a semaphore from an alarm handler function. The
> regular thread can then wait on the semaphore each time round the loop
> rather than calling cyg_thread_delay().

> http://ecos.sourceware.org/docs-latest/ref/kernel-semaphores.html

> I hope this helps

> John Dallaway

Thanks Stano and John. 

This is what I was after. 

I'll go with a semaphore for now, but flags look quite useful to control execution from various places so that a set of conditions have to be met.


Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list