OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

tx_set_transaction_timeout - Set transaction_timeout characteristic

Format

ANSI C, C++

#include <tx.h>
int  tx_set_transaction_timeout (TRANSACTION_TIMEOUT
                                 timeout)

K&R C

#include <tx.h>
int tx_set_transaction_timeout (timeout)
TRANSACTION_TIMEOUT timeout

Description

The function tx_set_transaction_timeout() sets the transaction_timeout characteristic to the value specified in timeout. This value specifies the time period in which the transaction must complete before becoming susceptible to transaction timeout; that is, the interval between the AP calling tx_begin() and tx_commit() or tx_rollback().

The function tx_set_transaction_timeout() may be called regardless of whether its caller is in transaction mode or not. If tx_set_transaction_timeout() is called in transaction mode, the new timeout value does not take effect until the next transaction.

The initial transaction_timeout value is 0 (no timeout).

<<Argument>>

<<timeout

The argument timeout specifies the number of seconds allowed before the transaction becomes susceptible to transaction timeout. It may be set to any value up to the maximum value for a type long as defined by the system. A timeout value of zero disables the timeout feature.>>

Return value

<<When return value is 0>>

Upon successful completion, tx_set_transaction_timeout() returns TX_OK, a non-negative return value. <<The transaction_timeout characteristic is the value set for timeout.>>

Errors

Under the following conditions, tx_set_transaction_timeout() does not change the setting of the transaction_timeout characteristic and returns one of these negative values.

Return value Return value (numeric) Explanation
TX_EINVAL -8 The timeout value specified is invalid.
TX_PROTOCOL_ERROR -5 The function was called in an improper context (for example, the caller has not yet called tx_open()).
TX_FAIL -7 The transaction manager encountered an error. The nature of the error is such that the transaction manager can no longer perform work on behalf of the application.

See also

tx_begin(), tx_commit(), tx_open(), tx_rollback(), tx_info().

<<Example>>

<<if (tx_set_transaction_timeout (TRANSACTION_TIMEOUT)
                                        == 0 && tx_commit() < 0 )
    fputs ("cannot commit transaction\n", stderr);>>

<<Note on use with OpenTP1>>

  1. <<tx_set_transaction_timeout() cannot be used along with the functions dc_trn_~().>>