Critical

Takes one parameter, the Name of the critical section

Description:

Critical takes a single parameter that is the name of the Critical Section you wish to enter. The name can be anything, and the name space is global across the entire system. For small and simple Procedures, you can choose to not provided a name and MOX will then use the name of the Procedure (Table.Name.Procedure) as the name.

It is possible to enter more than one Critical Section per Thread, and they follow the same general rules and functionality as Critical Sections in the operating system. In order to exit call Critical Sections, use End Critical. To exit a specific Critical, use End Critical {Name} with {Name} being the same value used on the Critical line.

The MOX Runtime protects against failing to exit a Critical Section before leaving a Procedure either due to a Runtime Error or a programmer's design flaw. A maximum of 1024 Critical Sections may be locked at one time.

Example:

Critical    "MemTab.Person"
...
End Critical


'Enter two, exit each
Critical "MemTab.Person"
Critical "MemTab.Contact"
...
End Critical "MemTab.Contact"
End Critical "MemTab.Person"


'Enter two, exit all
Critical "MemTab.Person"
Critical "MemTab.Contact"

End Critical