lrt_tpbegin

Transaction Handling Functions

Begins a transaction.

int lrt_tpbegin( unsigned long timeout, long flags );

timeout Transaction should be allowed at least this number of seconds before timing out.
flags Reserved for future use, should be set to 0.

The lrt_tpbegin function begins a System/T transaction. A transaction in System/T is a logical unit of work that either completely succeeds or has no effect. Transactions allow work being performed by many processes, possibly at different sites, to be treated as a single work unit. The initiator of the transaction can end the transaction using either lrt_tpabort or lrt_tpcommit.

Return Values

If the function ends with an error, it returns -1 and sets the error code in tperrno.

Parameterization

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

Example

In the following example, the lrt_tpbegin function begins a new transaction with a timeout of 30 seconds. If the transaction does not end in an error, the lrt_tpcommit statement commits the transaction.

Copy code
 /* Begin a new transaction with a timeout of 30 seconds*/
tpresult_int = lrt_tpbegin(30, 0);
.
.
lrt_abort_on_error();
lrt_tpcommit(0);