OpenTP1 Version 7 Programming Reference C Language
tx_close - Close a set of resource managers
Format
ANSI C, C++
#include <tx.h> int tx_close (void) |
K&R C
#include <tx.h> int tx_close() |
Description
The function tx_close() closes a set of resource managers in a portable manner. It invokes a transaction manager to read information specific to the resource manager in a manner specific to the transaction manager and pass this information to the resource managers linked to the caller.
The function tx_close() closes all resource managers to which the caller is linked. This function is used in place of close calls specific to the resource manager and allows an application program to be free of calls, which may hinder portability. Since resource managers differ in their termination semantics, the specific information needed to close a particular resource manager must be published by each resource manager.
The function tx_close() should be called when an application thread of control no longer wishes to participate in global transactions. The function tx_close() fails (returning TX_PROTOCOL_ERROR) if the caller is in transaction mode. That is, no resource managers are closed even though some may not be participating in the current transaction.
When tx_close() returns success (TX_OK), all resource managers linked to the calling thread are closed.
Return value
<<When return value is 0>>
Upon successful completion, tx_close() returns TX_OK, a non-negative return value. <<The set of resource managers linked to the caller was closed.>>
Errors
Under the following conditions, tx_close() fails and returns one of these negative values.
Return value | Return value (numeric) | Explanation |
---|---|---|
TX_PROTOCOL_ERROR | -5 | The function was called in an improper context (for example, the caller is in transaction mode). No resource managers are closed. |
TX_ERROR | -6 | Either the transaction manager or one or more of the resource managers encountered a transient error. All resource managers that could be closed are closed. |
TX_FAIL | -7 | 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. |
See also
tx_open().
<<Example>>
<<if (tx_info (NULL) == 0 && tx_close() < 0) fputs ("cannot close resource manager\n", stderr);>> |
<<Note on use with OpenTP1>>
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.