Open System Services Programmer's Guide

Example 81 Function with spt_RECEIVEREAD() and spt_REPLYX()
...
while (1)
{
if (spt_RECEIVEREAD() != 0) break;
...
// Do work.
...
if (spt_REPLYX() != 0) break;
}
...
Example 82 shows a single thread calling the thread-aware spt_RECEIVEREAD() function. Using
thread-aware $RECEIVE functions allows one or more threads to perform work on $RECEIVE,
without a thread unnecessarily blocking another thread.
374 Using the Standard POSIX Threads Library