Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

LOCK

1984 Version of ANSI Standard

3.6.11 LOCK

L[OCK] postcond

[ Space ]
Space L lockargument


    lockargument::=






nref
( L nref )


[ timeout ]

@ expratom V L lockargument





    nref::=

[ ^ ] name [ ( L expr ) ]
@ expratom V nref


See also the transition diagram for nref.

LOCK provides a generalized interlock facility available to concurrently executing MUMPS 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 to the naked indicator.

Each lockargument specifies a subspace of the total MUMPS name space for which the executing process seeks to make an exclusive claim; the details of this subspace specification are given below. Prior to evaluating and executing each lockargument, LOCK first unconditionally removes any prior claim on any portion of the name space made by the process as the result of a prior execution of LOCK. Then, if a lockargument is present, an attempt is made to claim the entire subspace defined by the lockargument. If this subspace does not intersect the union of all other subspaces claimed at this instant by all other processes defined by the implementor as sharing the interlock facility, the claim is successfully established and execution proceeds to the next lockargument or command. If the subspace defined by the lockargument intersects any other claimed subspace, execution of this process is suspended until all interfering claims are removed by one or more other processes, or, when a timeout is present, until the timeout expires, if that occurs first.

The subspace defined by one lockargument is claimed effectively all at once or not at all; thus, the observance of appropriate conventions on the use of the name space by all concurrently executing processes can eliminate the possibility of races and deadlocks.

If a timeout is present, the condition reported by $T upon resumption of execution is the successful establishment of the claim. If no timeout is present, execution of the lockargument does not change $T.

The subspace of the total name space defined by each lockargument is the union of the subspaces defined by each of the name references nref in the lockargument. Each nref specifies its subspace as follows.

  1. If the occurrence of nref is unsubscripted, then the subspace is the set of the following points: one point for the unsubscripted variable name nref and one point for each subscripted variable name N(s1, ..., si) for which N has the same spelling as nref.
  2. If the occurrence of nref is subscripted, then the subspace is the set of the following points: one point for the spelling of nref after all subscripts have been evaluated and one point for each descendant of nref. (See KILL for a definition of descendant.)

See also the transition diagram for Lock.

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

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)