6.2.3 Example: Sending a Synchronous Message with TPSIGRSTRT Set
The following listing is based on the TRANSFER
service, which is part of the XFER
server process of bankapp
. (bankapp
is a sample ATMI application delivered with the Oracle Tuxedo system.) The TRANSFER
service assumes the role of a client when it calls the WITHDRAWAL
and DEPOSIT
services. The application sets the communication flag to TPSIGRSTRT
in these service calls to give the transaction a better chance of committing. The TPSIGRSTRT
flag specifies the action to take if there is a signal interrupt. For more information on communication flags, refer to tpcall(3c)
in the Oracle Tuxedo ATMI C Function Reference.
Listing Sending a Synchronous Message with TPSIGRSTRT Set
/* Do a tpcall to withdraw from first account */
if (tpcall("WITHDRAWAL", (char *)reqfb,0, (char **)&reqfb,
(long *)&reqlen,TPSIGRSTRT) == -1) {
(void)Fchg(transf, STATLIN, 0,
"Cannot withdraw from debit account", (FLDLEN)0);
tpfree((char *)reqfb);
}
...
/* Do a tpcall to deposit to second account */
if (tpcall("DEPOSIT", (char *)reqfb, 0, (char **)&reqfb,
(long *)&reqlen, TPSIGRSTRT) == -1) {
(void)Fchg(transf, STATLIN, 0,
"Cannot deposit into credit account", (FLDLEN)0);
tpfree((char *)reqfb);
}
Parent topic: Sending Synchronous Messages