The CriticalRegion function has been implemented in order to avoid collisions on a SQL Server encyclopedia in a network environment. The function offers a form of exclusive access to the encyclopedia.
A critical region is an exclusive lock taken on a system resource so that any other process that attempts to start a critical region will wait until the current one is completed, thus allowing content sensitive processes to be single threaded. The call to end a Critical Region should only be made if the call to begin the Critical Region succeeded.begins or ends a critical region.
int CriticalRegion( BOOL bLock, /* Input: action to take - start or stop */ WORD IOErrorId) /* Input: Id for error reporting*/
Parameters
bLock
Boolean indicating whether to stop (FALSE) or to start (TRUE) the critical region
IOErrorId
Number ranging between 8600 and 9000 used for IO error reporting.
Return values
If the function succeeds the return value is SUCCESS, otherwise the value is DB_ERROR.