TBLT_RETC TBLT_ENTRY BltLockEx(TBLT_LOCKEX *lockExPtr, ULONG *slotPtr; ULONG timeout); lockExPtr I:lock control structure slotPtr O:slot that failed timeout I:timeout, in millisecondsThis routine locks all the items in the lock pack as a single transaction. If any of the operations fail, all previous operations are backed out.
The following TBLT_LOCKEX structure must be filled, one for each operation in the list to perform:
typedef struct _BLTLOCKEX { VOID *khdhPtr; // I:KH or DH of file ULONG mode; // I:LOCK_MODE_* ULONG recNoStart; // I:for DH locks ULONG recCount; // I:for DH locks ULONG action; // O:action performed (I:set to 0) ULONG flags; // I:operation flags VOID *rsvPtr; // set to 0 (used internally) VOID *nextPtr; // I:next TBLT_IUEX, or 0 if no more } TBLT_LOCKEX;
khdhPtr
may be either a TBLT_KH or TBLT_DH structure.
This routine performs a transaction of BltLockDataRecord()
and/or
BltLockIx4File()
calls, depending on khdhPtr->fType.
If khdhPtr refers to a data file, the BltLockDataRecord()
routine is
called for the operation (for mode
, recNoStart
, and
recCount
see BltLockDataRecord()
).
If khdhPtr refers to an index file, the BltLockIx4File()
routine is
called for the operation (for mode
see BltLockIx4File()
;
recNoStart
and recCount
are not used unless
FLAGSEX_LOCK_DUAL
is specified (see flags below)).
action
is the action performed on this list item. Action is set to
one of the following values for each operation in the list:
0 = nothing done (error encountered) 1 = locked index okay 2 = locked data okay 3 = locked index and data okay (possible if flags.bit7=1, 0x80)
flags
modifies the operation performed on this item:
FLAGSEX_LOCK_DUAL: if khdhPtr is an index file, then khPtr->xbLinkPtr is also locked using the information in .recNoStart and .recNoCount (flags.bit7=1)
rsvPtr
is used internally, and should be initialized to 0.
nextPtr
is used to link to the next operation in the list. Each
operation uses a separate TBLT_LOCKEX structure. When linked together via this
nextPtr, the list becomes the transaction list: each operation (each LOCKEX) is
executed in order; if all operations succeed, the transaction is successful.
Set .nextPtr to 0 in the last list operation.
If any lock operation failed, for whatever reason, all previous operations in the
list are backed out automatically, thereby unlocking previously successful locks
made in this transaction. *slotPtr
has the the list item that failed
(the first list item is 1).
timeout
is used as the timeout value (in milliseconds) for each lock
operation attempted. If a lock cannot be obtained within this time an error results
and a rollback is done automatically.
Return: Non-zero indicates an error, with *slotPtr set to the list item that failed (slot 1 is the first item in the list); otherwise all operations in the list completed successfully.