Applicable release versions: AP, R83
|Description||discussion of the various type of locking schemes available in Advanced Pick.
Advanced Pick supports 3 types of Group locks and 1 type of item lock. AP 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 Pick/BASIC, 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: (AP)
When an Update lock is placed on a group, no other process is allowed into the group for reading or writing.
Group Read-Only-Lock: (AP)
When a Read-Only lock is placed on a group, no Update locks are allowed. There may be multiple Read-Only locks set by multiple processes on a group at any one time.
Group Retrieval Lock: (AP)
Retrieval locks are supported only in releases of AP 6.0.0 and below. From a user standpoint, they function identically to Read-Only locks.
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 Pick/BASIC "readu", "readvu" and "matreadu" statements and by the Update processor.
The following program shows how the Pick/BASIC "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