(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_sys, prev: SUBSYSTEM, next: TIMCON)


SUSPND - Suspend Process


Allows a process to suspend itself or another process. Execution can be resumed with the vms_sys.resume() service. Warning! A process that has suspended itself can only be resumed from a different one.

Format:

    targpid = vms_sys.suspnd ([pidadr] [,prcnam] [,flags])
Returns:
targpid
Process identification of process that has been suspended.
The targed PID (targpid) is always returned - it is as if you have specified a '0' value for the 'pidadr' argument. If an error happens, then vms_sys.suspnd() raises a Python exception.

Please note: if you do a SUSPND on your own process, then it will 'hang'. You must issue a RESUME() from a different process to continue. And _after that_, you will get the 'targpid' value back (which, of course, is your own PID).

Arguments:
pidadr
Process identification of process to be suspended.
prcnam
Process name of process to be suspended.
flags
Bit flags specifying options for the suspend operation.
Examples:
>>> import vms_sys

>>> # suspend current process
>>> # Note: resume can only be done from a different process!
>>> print vms_sys.suspnd ()
(process 'hangs')
91                      <-- PID of current process
                        it was resumed via: >>> vms_sys.resume (91)
                        from a different process

>>> print vms_sys.suspnd (None)
(process 'hangs')
91                      <-- PID of current process is printed after
                        it was resumed via: >>> vms_sys.resume (91)
                        from a different process


>>> targ_pid = 93
>>> print vms_sys.suspnd (targ_pid)
93                      <-- PID of target process
                        this process now 'hangs'
>>> vms_sys.resume (targ_pid)
93                      <-- PID of target process
                        this process now continues


>>> print vms_sys.suspnd (0,"TARG_PRC")
93                      <-- PID of target process
                        this process now 'hangs'
>>> vms_sys.resume (targ_pid)
93                      <-- PID of target process
                        this process now continues


>>> # this example uses the PID that is returned
>>> targ_pid = vms_sys.suspnd (None,"TARG_PRC")
(target process 'hangs')
>>> print targ_pid
95                      <-- PID of target process
>>> vms_sys.resume (targ_pid)
95                      <-- PID of target process
                        this process now continues

* the flags argument cannot be used from Python because
  it runs in all user-mode code.


>>> nonexist_pid = 9999
>>> print vms_sys.suspnd (nonexist_pid)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (2280, '%SYSTEM-W-NONEXPR, nonexistent process')

>>> print vms_sys.suspnd (None,"NO_SUCH_PRC")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (2280, '%SYSTEM-W-NONEXPR, nonexistent process')
>>>

(go to: table of contents, index, list of vms_sys, prev: SUBSYSTEM, next: TIMCON)

28-SEP-1998 ZE.