qdb_setbusytimeout()

Set the busy timeout for a database connection

Synopsis:

#include <qdb/qdb.h>

int qdb_setbusytimeout( qdb_hdt_t *db, int timeout );

Arguments:

db
A pointer to the database handle to set the timeout for.
timeout
The timeout period, in milliseconds. This value may also be:
QDB_TIMEOUT_NONBLOCK
The equivalent of setting a timeout of 0. Calls to qdb_statement() return immediately with failure if the database file is locked.
QDB_TIMEOUT_BLOCK
The equivalent of an infinite timeout. Calls to qdb_statement() wait indefinitely or until the database is unlocked, at which point the call succeeds.

Library:

qdb

Description:

This function sets the busy timeout for the specified database connection. The initial value can be specified on the qdb command line with the -t option; by default, it's 5000 ms. Specifying a value of 0 is the same as setting QDB_TIMEOUT_NONBLOCK.

The busy timeout is the amount of time that a client can attempt to access a database before it returns EBUSY. If two clients attempt to write to the same database, the database is locked while the first client is writing and the second client's attempt will fail if the busy timeout period expires.

Note:

The timeout value is affected by the QDB_CONN_NONBLOCKING flag. If you enable this flag, the timeout is set to 0 or back to the -t value. Similarly, if you set the timeout to QDB_TIMEOUT_NONBLOCK, the flag is enabled.

The QDB_CONN_NONBLOCKING flag can be set with qdb_connect() and toggled with qdb_parameters().

Returns:

>=0
Success. The previous busy timeout setting is returned.
-1
An error occurred (errno is set).

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread Yes