User`s manual

58 digi.com Multitasking with Dynamic C
Figure 5-2 Execution thread when waitfor evaluates to false
Figure 5-3 shows the execution thread through a costatement when a waitfor evaluates to true.
Figure 5-3 Execution thread when waitfor evaluates to true
yield
The yield statement makes an unconditional exit from a costatement or a cofunction. Execution contin-
ues at the statement following yield the next time the costatement or cofunction is encountered by the
execution thread.
Figure 5-4 Execution thread with yield statement
costate ... {
statement
statement
}
...
waitfor( ... );
...
statement
statement
statement
costate ... {
statement
statement
}
...
waitfor( ... );
...
statement
statement
statement
(a) First Time (b) Subsequent Times
costate ... {
statement
statement
}
...
waitfor( ... );
...
statement
statement
statement