TMF Application Programmer's Guide (G06.26+)
Designing Multithreaded Processes
HP NonStop TMF Application Programmer’s Guide—522419-005
3-2
Manipulating the Current Transaction
filename
is the name of a variable containing the logical device name of the TMF
Management Process. The name is always $TMP. You can obtain the name
programmatically by calling the GETTMPNAME procedure.
filenumber
is the name of a variable into which the OPEN procedure returns a unique value
identifying this instance of the TFILE. You use filenumber in AWAITIO calls to
recognize completions of nowait ENDTRANSACTION calls. In addition, if the
requester is designed to run as a NonStop process pair, you also use
filenumber in CHECKPOINT calls to synchronize the content of the backup
requester’s TFILE with that of the primary requester’s TFILE.
nowait-depth
is the name of a variable containing the OPEN nowait-depth parameter. For a
multithreaded requester, this parameter must be within the range 2 through 1000
(specifying the maximum number of transactions that the requester can have open
concurrently).
A process can open the TFILE only once; attempts to open multiple instances of the
TFILE, or to open the TFILE after having called BEGINTRANSACTION, will fail with a
condition code of CCL and a file system error number 12 (file in use).
You close the TFILE by specifying filenumber in a CLOSE procedure call. Note that
if there are any transactions in progress when you close the TFILE, TMF automatically
aborts them.
Manipulating the Current Transaction
Multithreaded requesters must always include a variable name in the tag field of each
BEGINTRANSACTION call. The BEGINTRANSACTION procedure returns a value, by
way of that variable, that uniquely identifies each transaction.
After calling BEGINTRANSACTION, the newly initiated transaction automatically
becomes the current transaction.
Thereafter, you use the returned tag values in RESUMETRANSACTION procedure
calls to change the current transaction from one transaction to another.
As for single-threaded requesters, a successful call to ABORTTRANSACTION or
ENDTRANSACTION automatically resets the current transaction to the nil state.
Because a multithreaded requester is continually switching from one transaction to
another, each portion of code that resumes the processing of a transaction must first
set the current transaction to the proper value by calling RESUMETRANSACTION.
If the call to ABORTTRANSACTION or ENDTRANSACTION fails, the current
transaction identifier remains unchanged and is the same identifier that was supplied to
the procedure.