tx_begin
-begin a global transaction
#include <tx.h>
int tx_begin(void)
tx_begin
() is used to place the calling thread of control in transaction mode. The calling thread must first ensure that its linked resource managers have been opened (via tx_open
(3)) before it can start transactions. tx_begin
() fails (returning [TX_PROTOCOL_ERROR]) if the caller is already in transaction mode or tx_open
() has not been called.
Once in transaction mode, the calling thread must call tx_commit
(3) or tx_rollback
(3) to complete its current transaction. There are certain cases related to transaction chaining where tx_begin
() does not need to be called explicitly to start a transaction. See tx_commit
() and tx_rollback
() for details.
tx_set_transaction_timeout
(3)
Upon successful completion, tx_begin
() returns TX_OK
, a non-negative return value.
Under the following conditions, tx_begin
() fails and returns one of these negative values:
TX_OUTSIDE
]
TX_PROTOCOL_ERROR
]
TX_ERROR
]
TX_FAIL
]
tx_commit
(3), tx_open
(3), tx_rollback
(3), tx_set_transaction_timeout
(3)
XA-compliant resource managers must be successfully opened to be included in the global transaction. (See tx_open
(3) for details.) Both the X/Open TX interface and the X-Windows system defines the type XID. It is not possible to use both X-Windows calls and TX calls in the same file.