Function LOCK ( EFN:Event_Flag; TMO: integer): boolean; EXTERNAL; {*USER* LOCK a resource(s) associated with the global event flag EFN. If the resource is not available, continue trying for TMO seconds. The function LOCK returns a boolean value where TRUE is "resource locked for caller's use", and FALSE is "resource locked by another program and could not be locked for caller use within the TMO seconds" The LOCK function is used for interprogram coordination, permitting multiple programs to run and yet insure that only one among them can use a certain resource at a time. This function is useful for locking shared files, regions and ports in a system. The basic mechanism for signaling among programs is global flags. Both global and group global flags can be used. For all global flags that will be used, the lowest numbered flag in each DEC defined 16 flag group is reserved for use by this funtion for timeout handling. This means that if we used flags 43 and 44 for locking, then flag 33 is also used. If we use the group global group 65 thru 80, we can use any of the flag from 66 thru 80 for locking, but we cannot use flag 65, since this routine will use it. The function value returned is a boolean TRUE or FALSE. There is no other status. Any errors return the value of FALSE, giving little info on the type of error. For example, if you specify a flag out of range or one of the reserve "timeout flags", it will be an error, and a FALSE will be returned emulating a timeout. It is up to the caller to do validity checks if need be or to trace input values. Be sure group global flags are created before attempting to use them. If the group globals do not exist, a directive error will occur in the function, and the value of FALSE will be returned emulating a timeout. Note: This module uses a different locking scheme than normally used. A set flag denotes an unlocked file, region or port, while a clear flag denotes a locked file, region or port. This procedure enables us to use waits triggered by flag sets to make for instant response to a changed lock state while remaining inactive during the wait interval. This allows for the most efficient interactive file, region and port sharing possible by multiple programs. }