9.3.3 例: トランザクションの中断と再開
次のリストは、あるトランザクションを中断し、別のトランザクションを開始してコミットし、最初のトランザクションを再開する方法を示しています。コードを簡単にするために、エラー・チェック・コードは省略してあります。
トランザクションの中断と再開のリスト
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(. . . );
}
親トピック: トランザクションの中断と再開