TMF Application Programmer's Guide (G06.26+)
Designing Multithreaded Processes
HP NonStop TMF Application Programmer’s Guide—522419-005
3-12
Multithreaded Servers
Multithreaded Servers
Multithreaded servers differ from single-threaded servers in the following ways:
•
Multithreaded servers must open the $RECEIVE pseudofile with receive-depth
greater than 1.
•
Multithreaded servers must include the appropriate transaction tag in all REPLY
calls.
Opening $RECEIVE
To open the $RECEIVE pseudofile, a multithreaded server uses an OPEN call of the
following form (illustrated in TAL):
filename
is the name of a variable containing the character string $RECEIVE.
filenumber
is the name of a variable into which the OPEN procedure returns a unique value
identifying the $RECEIVE pseudofile. You will use that filenumber in
READUPDATE and REPLY calls to accept incoming messages and reply to the
associated requesters, respectively.
nowait-depth
is the name of a variable containing the FILE_OPEN_ nowait-depth parameter.
For a multithreaded server, this parameter is either a 0 or a 1. Zero (0) indicates
that I/O operations are to be waited, while 1 specifies that I/O operations are to be
completed by an AWAITIO call (nowait).
receive-depth
specifies the maximum number of incoming work requests that the server can have
received but not yet replied to at any one time. For multithreaded servers,
receive-depth must be within the range 2-2047.
A process can open $RECEIVE only once; attempts to open multiple instances of
$RECEIVE will fail with a condition code of CCL and the error number 12 (file in use).
You close $RECEIVE by specifying the returned filenumber in a CLOSE procedure
call. Note that if the server has any transactions in progress (messages queued in
$RECEIVE for which a reply has not yet been sent) when you close $RECEIVE, TMF
automatically aborts them.
CALL FILE_OPEN_ ( filename:8 , filenumber , , , nowait-depth
, receive-depth);