Locking Scheme

D3 locks groups on a process basis. A port executing a program is locked from accessing items locked by the previous level.

Group Update Lock

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.

Example(s)

The following program shows how the FlashBASIC locked clause can be used. It shows how to display the file name, 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

See Also

clear-basic-locks Macro

clear-locks Command

list-locks Command

Port Number

system() Function

ulk

unlock-file Command

unlock-group Command

unlock-item Command

what Command