(go to: table of contents, index, list of vms_sys, prev: DLCEFC, next: FILESCAN)
The Python interface routine expects a
'vmsobj_lksb' object. If the programmer
specifies 'None' for the lksb argument, then the interface routine
automatically generates a vmsobj_lksb object, passes the OpenVMS LKSB
to SYS$ENQW and returns the object in 'dict'!
Storage for the lock value block (LVB) is always allocated.
ENQW - Enqueue Lock Request
Note: the 'vms_lckdef' module contains
bitmasks and constants that are defined in '$LCKDEF'.
Format:
18-JUL-1999 ZE.
dict = vms_sys.enqw ([efn], lkmode, lksb, [flags], [resnam],
[parid], [astadr], [astprm], [blkast],
[acmode], [rsdm_id])
Returns:
Arguments:
Examples:
This is returned after a call to
vms_sys.set_resource_domain().
$ set PROCESS /NAME= PY_ENQW_TST
$ python
[...]
>>> import vms_sys, import vms_lckdef
>>> l_lkmode = vms_lckdef.LCK_K_NLMODE
>>> # Note: LKSB will be created automatically -v
>>> dict = vms_sys.enqw (None, l_lkmode, None, None,
... 'PY_RESNAM', None, None,
... None, None, None, None)
>>> for key in dict.keys():
... print key, '=', dict.get(key)
... #-for
...
lksb = <vmsobj_lksb, LKSB at 0x00289730>
status = 1 <-- from SYS$ENQW()
>>>
>>> # check status inside LKSB
>>> r_lksb = dict.get ('lksb')
>>> w_status = r_lksb.W_STATUS
>>> print vms_sys.getmsg (w_status) [0]
%SYSTEM-S-NORMAL, normal successful completion
>>>
-----
From a different process:
$ analyze /SYSTEM
VAX/VMS System analyzer
SDA> set process PY_ENQW_TST
SDA>
SDA> show process /lock
Process index: 0022 Name: PY_ENQW_TST Extended PID: 000000A2
----------------------------------------------------------------
Lock data:
Lock id: 2100000A PID: 00020022 Flags:
Par. id: 00000000 SUBLCKs: 0
LKB: 814A7040 BLKAST: 00000000
PRIORTY: 0000
Granted at NL 00000000-FFFFFFFF
Resource: 414E5345 525F5950 PY_RESNA Status:
Length 09 00000000 0000004D M.......
User mode 00000000 00000000 ........
Group 040 00000000 00000000 ........
Local copy
SDA>
-----
>>> w_status = r_lksb.W_STATUS
>>> # release the lock
>>> l_lockid = r_lksb.L_LOCKID
>>> print l_lockid
553648138
>>>
>>> (status, o_valblk) = vms_sys.deq (l_lockid)
>>> print (status, o_valblk)
(1, 0L)
>>> print vms_sys.getmsg (status) [0]
%SYSTEM-S-NORMAL, normal successful completion
>>>
-----
SDA> show process /lock
Process index: 0022 Name: PY_ENQW_TST Extended PID: 000000A2
----------------------------------------------------------------
%SDA-I-NOPRLOCK, no locks taken out by this process
SDA>
----------------------------------------
@@ more vms_sys.enqw() examples
>>>
(go to: table of contents,
index, list of vms_sys,
prev: DLCEFC,
next: FILESCAN)