2.7. Working While You Wait

Sometimes you will be able to get some work done while waiting for a message to arrive. In such cases, the PVMFNRECV(3) routine is a good substitute for PVMFRECV(3) for receiving a message. PVMFNRECV does a nonblocking receive (glossary ), meaning it does not wait until the message arrives but rather returns immediately if there is no message. By checking with PVMFNRECV periodically, your program can monitor the arrival of a message and execute other statements while it waits.

The following example outlines one way in which you can make use of PVMFNRECV:

     CALL PVMFNRECV (-1, 4, ARRIVED)
       IF (ARRIVED .EQ. 0) THEN
C           Do something else
       ELSE
C           Process data in message
       ENDIF