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_open(3c)

Name

tx_open()—Opens a set of resource managers.

Synopsis

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

Description

tx_open() opens a set of resource managers in a portable manner. It invokes a transaction manager to read resource-manager-specific information in a transaction-manager-specific manner and pass this information to the resource managers linked to the caller.

tx_open() attempts to open all resource managers that have been linked with the application. This function is used in place of resource-manager-specific "open" calls and allows an application program to be free of calls which may hinder portability. Since resource managers differ in their initialization semantics, the specific information needed to "open" a particular resource manager must be published by each resource manager.

If tx_open() returns TX_ERROR, then no resource managers are open. If tx_open() returns TX_OK, some or all of the resource managers have been opened. Resource managers that are not open will return resource-manager-specific errors when accessed by the application. tx_open() must successfully return before a thread of control participates in global transactions.

Once tx_open() returns success, subsequent calls to tx_open() (before an intervening call to tx_close()) are allowed. However, such subsequent calls will return success, and the TM will not attempt to reopen any RMs.

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

Return Value

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

Errors

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

[TX_ERROR]

Either the transaction manager or one or more of the resource managers encountered a transient error. No resource managers are open. The exact nature of the error is written to a log file.

[TX_FAIL]

Either the transaction manager or one or more of the resource managers encountered a fatal error. TX_FAIL is returned if tpinit() is not called before the call to tx_open in a secure application (SECURITY APP_PW). 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.

See Also

tx_close(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