Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Exclusive File Opens

Unix does not support effective exclusive file opens. If you remove #define ctNOEXCL, Unix supports exclusive file opens consistent with other environments, such as our client/server model or non-Unix FPUTFGET. However, this support uses a lock for each file opened by each user.

Defining ctLOCK_EXCLUSIVE when compiling ctclib.c undefines ctNOEXCL. This locks only the user lock region on an exclusive open. The disadvantage of this approach is that non-FairCom DB applications can update the file opened in exclusive mode within FairCom DB. To lock the entire file, use #define ctLOCK_EXCLUSIVE file. Locking the entire file appears to be very inefficient, especially with NFS mounted file systems, but it prevents non-FairCom DB applications from accessing the file.

To lock superfile members when the host is opened in shared mode requires a special case of the ctLOCK_EXTENDED technique. It is enabled with CTSUPER_MBRLOCK and may be applied to either ctLOCK_DIRECT or ctLOCK_EXTENDED.

Note: With exclusive file opens for Unix, and superfile member exclusive opens for both Unix and non-Unix systems, the maximum number of users supported is limited by ctMAX_USRLOKS, which defaults to 256. It may be overridden with your own #define ctMAX_USRLOKS placed in ctree.mak or ctoptn.h.

Exclusive file locks for superfile members, when the host is opened shared, are supported for ctLOCK_DIRECT and ctLOCK_EXTENDED unless CTSUPER_noMBRLOCK is defined. Disable this feature to reduce the number of locks held by an application. If this feature is not disabled, the maximum number of superfile members in a single host file is limited by ctMAX_MBRLOKS, which defaults to 1024, but may be overridden with your own #define ctMAX_MBRLOKS.

TOCIndex