☜ | LOCK1995 Version of ANSI (Equivalent to Current ISO Version) of Standard | ☞ |
L[OCK] postcond | │ │ │ |
[ SP ] SP L lockargument |
│ │ │ |
lockargument | ::= | │ │ │ │ │ │ |
@ expratom V L lockargument |
│ │ │ │ │ │ |
nref | ::= | │ │ │ |
[ ^ ] [ | environment | ]
name [ ( L expr ) ] @ expratom V nref |
│ │ │ |
Lock provides a generalized interlock facility available to concurrently executing M processes to be used as appropriate to the applications being programmed. Execution of Lock is not affected by, nor does it directly affect, the state or value of any global or local variable, or the value of the naked indicator. Its use is not required to access globals, nor does its use inhibit other processes from accessing globals. It is an interlocking mechanism whose use depends on programmers establishing and following conventions.
Each lockargument specifies a subspace of the total M Lock-UNIVERSE for the environment upon which the executing process seeks to make or release an exclusive claim; the details of this subspace specification are given below.
A special space for the lockspace is needed to create a synchronization mechanism for the executing process for each of the environments referenced by the executing process. A timeout refers to the time spent at the target environment, any time delays due to communication delays are not part of the timeout.
For the purposes of this discussion, the Lock-UNIVERSE is defined as the union of all possible nrefs in one environment after resolution of all indirection. Further, there exists for each process a Lock-LIST that contains zero or more nrefs. Execution of lockarguments has the effect of adding or removing nrefs from the process’ Lock-LIST. A given nref may appear more than once within the Lock-LIST. The nrefs in the Lock-LIST specify a subset of the Lock-UNIVERSE. This subspace, called the process’ LockSPACE, consists of the union of the subspaces specified by all nrefs in the Lock-LIST, as follows:
If the Lock command is argumentless, Lock removes all nrefs from the Lock-LIST associated with this process.
Execution of lockargument occurs in the following order:
An error occurs, with ecode="M41", if a process within a TRANSACTION attempts to remove from its Lock-LIST any nref that was present when the TRANSACTION started. With respect to each other process, the effect of removing any nref from the Lock-LIST is deferred until the global variable modifications made since that nref was added to the Lock-LIST are available to that other process.
Lock affects concurrent execution of processes having Lock-SPACES that OVERLAP. Two Lock-SPACEs OVERLAP when their intersection is not empty. Lock imposes the following constraints on the concurrent execution of processes:
See the TRANSACTION Processing subclause for the definition of TRANSACTION.
The constraints imposed by Lock on the execution of processes having Lock-SPACEs that OVERLAP may cause execution of one or more processes to be delayed. The maximum duration of such a delay may be specified with a timeout.
If present, timeout modifies the execution of Lock, described above, as follows:
If no timeout is present, then the value of $Test is not affected by execution of the lockargument.
Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.
This page most recently updated on 15-Nov-2023, 14:45:36.
For comments, contact Ed de Moel (demoel@jacquardsystems.com)