LEGO Mindstorms EV3

Wait for Completion

All system calls can affect the dispatch status.

If a system call is completed at once it will not change the dispatch status
If a system call is not completed it will set the dispatch status to "BUSYBREAK"
If a system call fails the dispatch status will be "FAILBREAK"
To check for completion of a system call the XXXXXXX_READY (eg. OUTPUT_READY) system call is used. XXXXXXX_READY blocks the calling object at user level until the specific resource function is completed/failed and then it sets the dispatch status to "NOBREAK" or "FAILBREAK"
In the case were another object has used the same resource and the first object checks for completion it gets a status equal to "NOBREAK"

In practice the specific resource saves the calling object id when the function is called and when XXXXXXX_READY is called and the function is not completed the id is checked against the saved one:

if saved id equals calling id the status will be "BUSYBREAK"
if saved id is not equal to calling status will be "NOBREAK"
XXXXXXX_TEST can be used to test a resource: if it is busy it will block the calling object by setting the dispatch status to "BUSYBREAK" until not busy.

LEGO® Robotics Firmware Documentation
Confidential Information © 2013 The LEGO Group