Skip navigation.

ATMI C Function Reference

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

 


tx_commit(3c)

Name

tx_commit()—Commits a global transaction.

Synopsis

#include <tx.h> 
int tx_commit(void)

Description

tx_commit() is used to commit the work of the transaction active in the caller's thread of control.

If the transaction_control characteristic (see tx_set_transaction_control(3c)) is TX_UNCHAINED, then when tx_commit() returns, the caller is no longer in transaction mode. However, if the transaction_control characteristic is TX_CHAINED, then when tx_commit() returns, the caller remains in transaction mode on behalf of a new transaction (see the Return Value and Errors sections below).

In a multithreaded application, a thread in the TPINVALIDCONTEXT state is not allowed to issue a call to tx_commit().

Optional Set-up

Return Value

Upon successful completion, tx_commit() returns TX_OK, a non-negative return value.

Errors

Under the following conditions, tx_commit() fails and returns one of these negative values:

[TX_NO_BEGIN]

The current transaction committed successfully; however, a new transaction could not be started and the caller is no longer in transaction mode. This return value may occur only when the transaction_control characteristic is TX_CHAINED.

[TX_ROLLBACK]

The current transaction could not commit and has been rolled back. In addition, if the transaction_control characteristic is TX_CHAINED, a new transaction is started.

[TX_ROLLBACK_NO_BEGIN]

The transaction could not commit and has been rolled back. In addition, a new transaction could not be started and the caller is no longer in transaction mode. This return value can occur only when the transaction_control characteristic is TX_CHAINED.

[TX_MIXED]

The work done on behalf of the transaction was partially committed and partially rolled back. In addition, if the transaction_control characteristic is TX_CHAINED, a new transaction is started.

[TX_MIXED_NO_BEGIN]

The work done on behalf of the transaction was partially committed and partially rolled back. In addition, a new transaction could not be started and the caller is no longer in transaction mode. This return value can occur only when the transaction_control characteristic is TX_CHAINED.

[TX_HAZARD]

Due to a failure, some of the work done on behalf of the transaction may have been committed and some of it may have been rolled back. In addition, if the transaction_control characteristic is TX_CHAINED, a new transaction is started.

[TX_HAZARD_NO_BEGIN]

Due to a failure, some of the work done on behalf of the transaction may have been committed and some of it may have been rolled back. In addition, a new transaction could not be started and the caller is no longer in transaction mode. This return value can occur only when the transaction_control characteristic is TX_CHAINED.

[TX_PROTOCOL_ERROR]

The function was called in an improper context (for example, the caller is not in transaction mode). The caller's state with respect to transaction mode is not changed.

[TX_FAIL]

Either the transaction manager or one or more of the resource managers encountered a fatal error. The nature of the error is such that the transaction manager and/or one or more of the resource managers can no longer perform work on behalf of the application. The exact nature of the error is written to a log file. The caller's state with respect to the transaction is unknown.

See Also

tx_begin(3c), tx_set_commit_return(3c), tx_set_transaction_control(3c), tx_set_transaction_timeout(3c)

Warnings

Both the X/Open TX interface and the X-Windows system define the type XID. It is not possible to use both X-Windows calls and TX calls in the same file.

 

Skip navigation bar  Back to Top Previous Next