9.3.3 Example: Suspending and Resuming a Transaction
The following listing shows how to suspend one transaction, start and commit a second transaction, and resume the initial transaction. For the sake of simplicity, error checking code has been omitted.
Listing Suspending and Resuming a Transaction
DEBIT(SVCINFO *s)
{
TPTRANID t;
tpsuspend(&t,TPNOFLAGS); /* suspend invoking transaction*/
tpbegin(30,TPNOFLAGS); /* begin separate transaction */
Perform work in the separate transaction.
tpcommit(TPNOFLAGS); /* commit separate transaction */
tpresume(&t,TPNOFLAGS); /* resume invoking transaction*/
.
.
.
tpreturn(. . . );
}
Parent topic: Suspending and Resuming a Transaction