The table below lists the lock modes that are to be used with the session-wide record locking function ctdbLock().
c-treeDB API Lock Modes |
c-treeDB API .NET |
|
---|---|---|
CTLOCK_FREE |
FREE_LOCK |
Turn off session-wide record locking. Free all automatically-acquired locks (with certain exceptions, see below). |
CTLOCK_READ |
READ_LOCK |
Non-blocking read locks. If the lock cannot be acquired an error is returned. |
CTLOCK_READ_BLOCK |
READ_BLOCK_LOCK |
Blocking read lock. The thread will block until the lock can be acquired. |
CTLOCK_WRITE |
WRITE_LOCK |
Non-blocking write lock. If the lock cannot be acquired an error is returned. |
CTLOCK_WRITE_BLOCK |
WRITE_BLOCK_LOCK |
Blocking write lock. The thread will block until the lock can be acquired. |
CTLOCK_RESET |
RESET_LOCK |
Equivalent to calling Lock with CTLOCK_FREE followed by Lock() with CTLOCK_WRITE. This releases currently-held record locks (with certain exceptions, see below). |
CTLOCK_SUSPEND |
SUSPEND_LOCK |
Temporarily suspend session-wide record locking. While locking is suspended, new record reads, writes, and deletes will not be automatically locked. Existing record locks remain in place, though. |
CTLOCK_RESTORE |
RESTORE_READ_LOCK |
To be used after a call to Lock with the CTLOCK_SUSPEND mode. This lock mode restores the lock mode as READ. |
CTLOCK_RESTORE |
RESTORE_READ _BLOCK_LOCK |
To be used after a call to Lock with the CTLOCK_SUSPEND mode. This lock mode restores the lock mode as READ_BLOCK. |
CTLOCK_RESTORE |
RESTORE_WRITE_LOCK |
To be used after a call to Lock with the CTLOCK_SUSPEND mode. This lock mode restores the lock mode as WRITE. |
CTLOCK_RESTORE |
RESTORE_WRITE _BLOCK_LOCK |
To be used after a call to Lock with the CTLOCK_SUSPEND mode. This lock mode restores the lock mode as WRITE_BLOCK. |
CTLOCK_RESTORE |
|
To be used after a call to Lock with the CTLOCK_SUSPEND mode. This lock mode restores the same lock mode that was valid before suspending the lock. |
c-treeDB API .NET Lock Modes are defined in the LOCK_MODE enum.
Notes:
The modes listed in this table (except for the “RESET” and “_RESTORE_” modes) are also returned by the ctdbGetLockMode() function to show the current state of the session-wide locking system.