[ECOS] How to reset the timeout on a thread waiting for a flag

Jonathan Larmour jifl@eCosCentric.com
Tue Jan 28 04:36:00 GMT 2003

Fabrice Gautier wrote:
> Hi,
> Here is what i want to do:
> I have a thread starting an operation and waiting for it to finish. The
> operation result in a series of interrupts. The thread waits on a flag, and
> the ISR will eventually set the flag when the operation is done, to wake up
> the thread. 

DSR I hope :-).

> I also want a timeout. But not a total timeout value for the total operation
> but a timeout based on the interrupt activity. ie if there is no more
> interrupt for 1/2sec then i want to timeout.
> So is ther any function to reset the thread timer. 

Not exported in C (nor should it be really). You could look in the C++ 
headers, but there be dragons.

But I would imagine an alternative way to do this is to use two flag bits 
with cyg_flag_timed_wait() - one bit set on each interrupt, and the other 
when the operation completes. It's used with CYG_FLAG_WAITMODE_OR.

Then when the thread wakes up, it checks why it woke up, and if necessary 
waits again for the operation to complete.

eCosCentric       http://www.eCosCentric.com/       <info@eCosCentric.com>
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine

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

More information about the Ecos-discuss mailing list