[semidet]bdb_transaction(:Goal)error(package(db, deadlock), _)
This exception indicates a deadlock was raised by one of the DB predicates. Deadlocks may arise if multiple processes or threads access the same keys in a different order. The DB infra-structure causes one of the processes involved in the deadlock to abort its transaction. This process may choose to restart the transaction.
For example, a DB application may define {Goal} to
realise transactions and restart these automatically is a deadlock is
raised:
{Goal} :-
catch(bdb_transaction(Goal), E, true),
( var(E)
-> true
; E = error(package(db, deadlock), _)
-> {Goal}
; throw(E)
).
| Environment | defines the environment to which the transaction applies. If omitted, the default environment is used. See bdb_init/1 and bdb_init/2. |