Download AMOS Basic XCALL subs
Transcript
CHAPTER 5 XLOCK — XCALL SUBROUTINE FOR MULTLSER LOCKS XLOCK is an external subroutine that your AIphaBASIC program can call to set and test "locks." Lock is a tool to help you synchronize attempts to access devices and files. You can Imagine the problems that result when you have two users lock A trying to update the same record of the same file at the same time. track of whether a certain is an entity created by a program to help it keep device, file, etc., is in use at the specific time that the program wants to The general way that the Locking system works is this: access It. A 1. prevent access to something (a fiLe, a device, When you want to etc.) while Vour program accesses 'it, you create (that is, "set") a system lock on that resource. 2. Whenever you want to access a device or file, your program tries to set the lock associated with that item; if it is already set, you know that another user's program is using the device or file. 3. When you are finished accessing a device or file, you destroy (that so that other programs can now access the lock the is, "ctear') resource. If convenience, Note that a system lock is NOT a security device—— it's a a program wants to allowlis users to write to a fiLe without checking to see if another user is there first, It can, do so (and run the risk of A system Lock simply provides a convenient way to help a creating chaos). program keep its users from conflicting in their attempts to use system resources. The only job that can clear a Lock is the Job that originally program set the Lock. AIphaBASIC does not automatically clear locks when a exits, so be careful that your program clears any locks it has set before it (For more background information on why Locks are necessary, see exits. Chapter 4, "FLOCK — XCALL Subroutine to Coordinate Multi—user File Access.") DSS—10008—OO REV A®