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

Reply via email to