Product Site

15.4.1.1. Rules for Running Guarded Methods

ooRexx ensures that guarded methods of the same scope (defined for the same class) cannot execute concurrently to protect access to its attribute pool (object variable pool). To do so, a counter-based guard lock is maintained for each scope, which gets increased by one if a guarded method gets invoked and decreased by one upon return. If a guarded method for the same scope gets invoked from another thread and the scope's guard lock counter is not zero, it gets blocked because another guarded method holding the guard lock is currently running in the same scope. Once the scope's guard lock counter drops to 0 (no other guarded method runs currently), the blocked guarded method can acquire the guard lock, thereby increasing the guard lock counter to one and starting to run.