Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Set A Busy Timeout

int sqlite3_busy_timeout(sqlite3*, int ms);

This routine sets a busy handler that sleeps for a while when a table is locked. The handler will sleep multiple times until at least "ms" milliseconds of sleeping have been done. After "ms" milliseconds of sleeping, the handler returns 0 which causes sqlite3_step() to return SQLITE_BUSY or SQLITE_IOERR_BLOCKED.

Calling this routine with an argument less than or equal to zero turns off all busy handlers.

There can only be a single busy handler for a particular database connection. If another busy handler was defined (using sqlite3_busy_handler()) prior to calling this routine, that other busy handler is cleared.

Invariants:

F12341 The sqlite3_busy_timeout() function overrides any prior sqlite3_busy_timeout() or sqlite3_busy_handler() setting on the same database connection.
F12343 If the 2nd parameter to sqlite3_busy_timeout() is less than or equal to zero, then the busy handler is cleared so that all subsequent locking events immediately return SQLITE_BUSY.
F12344 If the 2nd parameter to sqlite3_busy_timeout() is a positive number N, then a busy handler is set that repeatedly calls the xSleep() method in the VFS interface until either the lock clears or until the cumulative sleep time reported back by xSleep() exceeds N milliseconds.

See also lists of Objects, Constants, and Functions.


This page last modified 2008/01/31 20:37:13 UTC