Next: Iterating, Previous: Complex statements, Up: Complex statements [Contents][Index]
The
THEN
keyword separates statements that are to be
performed sequentially. For example, a simple ping-pong
communication can be expressed as follows:
ALL TASKS RESET ALL COUNTERS THEN TASK 0 SENDS A 0 BYTE MESSAGE TO TASK 1 THEN TASK 1 SENDS A 0 BYTE MESSAGE TO TASK 0 THEN TASK 0 LOGS elapsed_usecs/2 AS "One-way latency"
There is no implicit intertask synchronization across THEN
statements.
Consequently, the two communications specified in the following
statement will be performed concurrently:
TASK 0 ASYNCHRONOUSLY SENDS AN 8 KILOBYTE MESSAGE TO TASK 1 THEN TASK 1 ASYNCHRONOUSLY SENDS AN 8 KILOBYTE MESSAGE TO TASK 0 THEN ALL TASKS AWAIT COMPLETION