Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

Resource Locks

It is expected that you process resource updates without permitting user interactions to occur during the actual update. It is important for performance considerations and c-treeDB assumes that resource entries will be locked only for very short intervals. Do not lock a resource and then request user input. Be careful not to include resource updates, (additions, deletions or updates), in long held transactions when the table is under transaction processing control. Locks cannot be released until a transaction either commits or aborts.

c-treeDB resource handling automatically unlocks resources when necessary, however, a resource can be manually unlocked by the user. Use the following function to check if a resource is locked or not:

CTBOOL CTResource::IsLocked() const;

CTResource::IsLocked() returns YES if the resource referenced by the resource handle is locked, otherwise it returns NO. The following method should be used to unlock resources whose locks are no longer necessary:

void CTResource::Unlock();

CTResource::Unlock() releases a lock placed on a resource by one of the following read resource functions: CTResource::First(), CTResource::Next() and CTResource::Find().

c-treeDB C++ API Resource Locking Example


if (hRes->IsLocked())

hRes->Unlock();

TOCIndex