DRLOCK C-3


NAME



drlock, drlockw, drunlock - lock/unlock a data record for
exclusive use

SYNOPSIS



#include

int drlock (record, fcb)
rno_t record;
DFILE *fcb;

int drlockw (record, fcb)
rno_t record;
DFILE *fcb;

int drunlock (record, fcb)
rno_t record;
DFILE *fcb;

DESCRIPTION



Drlock attempts to lock a data record for exclusive use and
returns immediately with a status code. If the record was locked
successfully, drlock returns a positive value. If the record
could not be locked, perhaps because it was already locked by
another process, a zero value is returned.

Drlockw attempts to lock a record for exclusive use and waits
until the record can be locked before returning. Drlockw normally
returns a positive value.

Drunlock unlocks a record that was locked with drlock or drlockw.

The record number to be locked is specified by the record
parameter, where record is between 1 and number of records in the
RMSfile. Record is returned by all calls that access the
RMSfile. Fcb is the file block pointer returned by dlopen(C-3) or
dopen(C-3).

These routines must be used in a multi-user environment when
calling RMS file functions that update records to prevent
simultaneous access to data by more than one user. The RMS file
functions do not automatically lock files or records to prevent
simultaneous access to data.

These routines lock only one record at a time. It is permissible
to lock more than one record in the same RMSfile or to lock
records in more than one RMSfile. Please note that locking more
than one record at a time may create a deadlock in which case the
request will be denied.


In MS-DOS , these routines perform no operation and always return
1.

SEE ALSO



dflock(C-3), dclock(C-3), dilock(C-3), dlopen(C-3), dopen(C-3)
Chapter 4, RMS Programming Guide

DIAGNOSTICS

Drlock and Drlockw return a value of zero (0) if fcb is not an
opened file block pointer or if locking the requested record
would cause a deadlock.