Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

Locking

The most significant difference between coding applications for single-user environments and multi-user environments (including local area networks) has to do with performing record updates (rewrites) and record deletions.

The basic problem is that to perform a record update or delete in a multi-user system, you must own a record lock on the record of interest. Locks should be acquired when the user reads the record in preparation for updates, and should not relinquish the lock until the update is completed. However, one must be careful to help ensure that locks are held for the shortest time possible or the performance of the application will be adversely affected.

Two types of locks can be applied to a record:

  • A READ lock (also called a "shared" lock) on a record allows an unlimited number of other READ locks on that record (from other threads, etc), but prevents WRITE locks.
  • A WRITE lock (also called an "exclusive" lock) prevents any other locks (of either type) on that record.

For a full list of lock modes, see Lock Modes.

In This Section

Starting Locks

Lock Modes

Freeing Locks

Freeing Locks Associated with a Table

TOCIndex