C and C++ ISAM Programmers Guide

Previous Topic

Next Topic

Record Locking

Record locking controls which user is going to be able to access and update a given record. When multiple users are accessing a data file in ctSHARED file mode use record locking to prevent several users from updating the same record at the same time. For low-level functions, use LockCtData(). For ISAM functions, use LockISAM().

In c-treeACE, we define two types of record locks: write locks and read locks.

Write Locks

A write lock can be considered an exclusive lock. Only one user can have a write lock on a given record. A write lock also prevents anyone from getting a read lock on the same record. This is used when a user must update a record, and needs to prevent other users from updating at the same time. Use the record lock mode of ctENABLE.

Read Locks

A read lock can be considered a shared lock. Any number of users can have a read lock on a record simultaneously. A read lock on a record will prevent another user from getting a write lock on this record. Use this to allow one or more users to look at a record while ensuring that it cannot be changed or deleted by another user while they are looking at it. Use a record lock mode of ctREADREC.

The c-treeACE client and the c-treeACE Server DO support read locks in addition to write locks.