On 20 August 2014 09:33, Marius Liebenberg <[email protected]> wrote:
> What will be the best way to handle a timeout or delay of several
> seconds in a component?
It depends on how many waits there are.
If it is only a single wait, or at least very few, then just have a wait-state
long long wait_until;
...
switch (my_state){
...
case N:
wait_until = rtapi_get_time() + 7e9;
my_state = 12;
break;
case 12:
if (rtapi_get_time() > wait_until) my_state = 13;
break;
If you need to wait in many places, then have a second variable to
hold the "next state" and "timeout_state" to return to after a
dedicated waiting state.
--
atp
If you can't fix it, you don't own it.
http://www.ifixit.com/Manifesto
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers