locking scheme

locking scheme


linked overflow Index Level locks
Syntax
Category Definitions
Type Definition
Description discussion of the various type of locking schemes available in D3.

D3 supports 3 types of Group locks and 1 type of item lock.  D3 locks groups on a process basis. A port executing a program will be locked from accessing items locked by the previous level.

Group Locks: (R83)

Under R83, when accessing or updating an item in a file, the complete group is locked from all others. When a process attempts to access a locked group, the user process is suspended and the terminal beeps until the group is unlocked. From FlashBASIC, users may regain control when a group is locked by using the LOCKED clause with the MATREADU, READU, and READVU statements. The READ statement ignores locked groups with R83 3.1.

Group Update Lock: (D3)

When an Update lock is placed on a group, no other process is allowed into the group for reading or writing.

Item Lock:

When an item lock is placed on an item in a file, other items in that group are allowed to be accessed and updated. A Group lock is placed on the group to prevent shifting, the item is locked and the group is released, leaving the item lock in place. Item locks are used by the FlashBASIC "readu", "readvu" and "matreadu" statements and by the Update processor.
Options
See Also unlock-item what unlock-group clear-basic-locks list-locks port.number clear-locks SYSTEM list-locks (R83) ulk unlock-file
Example The following program shows how the FlashBASIC "locked" clause can be used. It shows how to display the filename, port.number, and user that has the file locked:

prompt "";item=""
open '','filename' to f.filename else stop
open '','users' to f.users else stop
readu item from f.filename,ID locked
 execute "who ":port capturing var
 user.id = field(var," ",2)
 readv name from f.users,user.id,1 else stop
 print "Filename file is locked by port ":port:" ":name
 loop until port = 0 do
   sleep 5
   readu item from f.filename,ID locked else null
   port=system(0)
 repeat
end else stop 202,ID
release
end
Warnings
Compatibility D3 7.0 AP R83
linked overflow Index Level locks