Looking at the code, the explanation is a little bit off. The instruction does the following:
set the guard state to the indicated state while when expresson != true release GUARD lock wait for an expression variable to be updated. restore the GUARD lock to the desired state end So, any time the GUARD instruction is waiting for a variable to update, it does not hold the GUARD lock, so that other methods are able to run and update the variables it is waiting on. Using GUARD WHEN gives permission for the lock to be released. I'd say the last two sentences are a bit dodgy. Rick On Fri, Apr 7, 2023 at 12:26 PM Erich Steinböck <erich.steinbo...@gmail.com> wrote: > If in this, heavily GUARDED example m2 can start running while m1 is > running, and later > m1 can get back control even though m2 is running GUARDED, then how can > any method make sure it runs with exclusive access? > > Am I missing something? > > ~~~ > c = .c~new > c~m1 > c~m2 > > ::class c > > ::method m1 guarded > expose a > guard on > reply > guard on > say "m1 start" > guard on when a = 3 > say "m1 end" > > ::method m2 guarded > expose a > guard on > say 'm2 start' > do a = 1 to 5 > call SysSleep 0.2 > say "m2, a =" a > end > say "m2 end" > ~~~ > > gives > > ~~~ > m1 start > m2 start > m2, a = 1 > m2, a = 2 > m1 end > m2, a = 3 > m2, a = 4 > m2, a = 5 > m2 end > ~~~ > > This came up when I read rexxpg how GUARD OFF WHEN is supposed to work and > couldn't make much sense out of what it says: "if you specify "GUARD OFF > WHEN expression," the active method keeps running until expression becomes > true. To become true, another method must assign or drop an object variable > that is named in expression. Whenever an object variable changes, Rexx > reevaluates expression. If expression becomes true, GUARD is turned off, > exclusive use of the variable pool is released, and other methods needing > exclusive use can begin running. If expression becomes false again, GUARD > is turned on and the active method regains exclusive use." > > Especially "keeps running" and the last sentence don't seem right to me. > _______________________________________________ > Oorexx-devel mailing list > Oorexx-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/oorexx-devel >
_______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel