Berkeley DB Reference Guide: Locking Subsystem
Полезная информация

Berkeley DB Reference Guide: Locking Subsystem

Standard lock modes

The Berkeley DB include files declare two commonly used conflict arrays:

const u_int8_t db_lock_rw_conflicts[ ];
This is a conflict array for a simple scheme using shared and exclusive lock modes.

const u_int8_t db_lock_riw_conflicts[ ];
This is a conflict array that involves various intent lock modes (e.g., intent shared) that are used for multigranularity locking.

Their associated sizes are DB_LOCK_RW_N and DB_LOCK_RIW_N.

In addition, the Berkeley DB include file defines the type db_lockmode_t, which is the type of the lock modes used with the standard tables above:

DB_LOCK_NG
not granted (always 0)

DB_LOCK_READ
read (shared)

DB_LOCK_WRITE
write (exclusive)