Start acquiring locks by passing the appropriate lock mode to the Lock method inherited by CTSession(), CTDatabase(), CTTable(), and CTRecord() from CTBase().
// start locking
ARecord.Lock(CTLOCK_WRITE_BLOCK);
After a successful call to Lock, the c-treeDB API locks all records as they are read using the lock mode passed to Lock. Suspend record locking temporarily by calling the Lock function with the mode CTLOCK_SUSPEND. Suspending locks does not release any locks, but while locks are suspended, no record reads are automatically locked.
// suspend locking
ARecord.Lock(CTLOCK_SUSPEND);
Suspended locking can be resumed by calling Lock with a resume lock mode: CTLOCK_RESUME_READ, CTLOCK_RESUME_LOCK_BLOCK, CTLOCK_RESUME_WRITE, or CTLOCK_RESUME_WRITE_BLOCK.
// resume locking
try
{
ARecord.Lock(CTLOCK_RESUME_WRITE_BLOCK);
}
catch (CTException &err)
{
printf("Resume lock failed with error %d\n", err.GetErrorCode());
}