This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Question on RTX51Tiny os_wait

What would happen if you have an os_wait or os_wait2 call with an interval of X milliseconds, such as

while {TRUE) {
os_wait2(K_IVL, X);
//do some stuff
}

and the "stuff" takes more than X ticks?

Parents
  • What would happen if you have an os_wait or os_wait2 call with an interval of X milliseconds...and the "stuff" takes more than X ticks?

    The os_wait function will return immediately in this case.

    Each task includes a timer "delay" that decrements once for each timer tick. If you wait for 5 ticks, 5 is added to this tick (which starts at 0 for the first call to os_wait for an interval). And, the new value is 5. After 5 time ticks, the value will be 0 and the task will be run again.

    So, if you ask for an interval of 5 ticks and the current "delay" time is -5 or lower, the task will re-start immediately.

    So, if the interval is ALWAYS less than the stuff, no other tasks will run.

    Jon

Reply
  • What would happen if you have an os_wait or os_wait2 call with an interval of X milliseconds...and the "stuff" takes more than X ticks?

    The os_wait function will return immediately in this case.

    Each task includes a timer "delay" that decrements once for each timer tick. If you wait for 5 ticks, 5 is added to this tick (which starts at 0 for the first call to os_wait for an interval). And, the new value is 5. After 5 time ticks, the value will be 0 and the task will be run again.

    So, if you ask for an interval of 5 ticks and the current "delay" time is -5 or lower, the task will re-start immediately.

    So, if the interval is ALWAYS less than the stuff, no other tasks will run.

    Jon

Children