lrt_tpscmt

Transaction Handling Functions

Sets when the lrt_tpcommit should return.

int lrt_tpscmt( long flags );

flags Define how lrt_tpcommit should behave with respect to returning control to its caller. Two possible values:TP_CMT_LOGGED - indicates that lrt_tpcommit should return after the commit decision has been logged by the first phase of the two-phased commit protocol, but before the second phase has completed.TP_CMT_COMPLETE - indicates that lrt_tpcommit should return after the two-phase commit protocol has finished completely.

The lrt_tpscmt function is used in conjunction with lrt_tpcommit to set when the lrt_tpcommit should return.

Return Values

If the function succeeds, it returns the previous value of the TP_COMMIT_CONTROL characteristic. If it fails, it returns -1 and sets tperrno to indicate the error condition.

Parameterization

You cannot use standard parameterization for any arguments in this function.

Example

In the following example , the lrt_tpscmtfunctionsets lrt_tpcommit to return after the protocol is completed.

Copy code
int tpresult_int;
    /* Begin a new transaction with a timeout of 30 seconds*/
    tpresult_int = lrt_tpbegin(30, 0);
    lrt_abort_on_error();
    /* Set lrt_tpcommit to return after the two-phase commit     protocol has finished completely. */
    lrt_tpscmt (TP_CMT_COMPLETE);
    lrt_tpcommit(0);