Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

Demoting Record Locks

If a record has acquired a write lock, it is possible to change or demote the write lock to a read lock if the record has not been updated. Use the CTRecord.LockRecord() method to demote a record with a write lock to a read lock.

// demote a write lock to a read lock

if (ARecord.GetRecordLock() == LOCK_MODE.WRITE_LOCK)

{

try

{

ARecord.LockRecord(LOCK_MODE.READ_LOCK);

}

catch (CTException err)

{

Console.Write("Demote lock failed with error {0}\n", err.GetErrorCode());

}

}

TOCIndex