Open System Services Programmer's Guide

For details on each function, see the appropriate reference page in the Open System Services
System Calls Reference Manual.
The functions listed above provide only basic $RECEIVE handling support, not higher-level
capabilities associated with a $RECEIVE package. You can build such higher-level functions using
the primitives present in the thread-aware $RECEIVE functions, but must tailor them for whatever
domain-specific application they occur in. High-level capabilities not supported by the thread-aware
$RECEIVE functions include:
Maintenance of an opener’s table
Pathway server semantics (exit upon last close)
Automatic resend of last replies for NonStop requesters
Distribution of messages based on type or opener
Any special handling of system messages (system messages are supported, but are treated
as any other message)
Encapsulation of the open or close of $RECEIVE, or any SETMODE
Table 62 Thread-Aware $RECEIVE Functions and Types
DescriptionFunction
Register filenum being managed by the $RECEIVE callbackspt_INITRECEIVE()
Thread-aware function specifically for reading $RECEIVEspt_RECEIVEREAD()
Thread-aware REPLYX()spt_REPLYX()
Thread-aware READX()spt_READX()
Using Thread-Aware $RECEIVE Functions
Example 80 through Example 82 show using thread-aware $RECEIVE functions.
Example 80 (page 373) shows the program flow for using a thread-aware $RECEIVE function.
Example 80 Thread-Aware $RECEIVE Program Flow
...
FILE_OPEN(, &filenum, , receive_depth, );
spt_INITRECEIVE(filenum, receive_depth);
...
// Do work on filenum.
...
spt_unregFile(filenum);
FILE_CLOSE(filenum);
...
Example 81 shows using the thread-aware functions spt_RECEIVEREAD() and spt_REPLYX()
to perform the actual work on $RECEIVE.
Reentrant OSS Functions 373