On 11.02.2023 18:16, Rick McGuire wrote:
Some comments:
1) the T and A columns are a bit redundant. We really only need a single identifier for the
thread, having two is just extra clutter.
2) The term activity is introduced here without explanation. It doesn't really appear any other
place in the documentation and is really more of an internal concept than part of the language. If
it is used here, then this needs to be used consistently in all other places that concurrency is
discussed.
3) The variable pool term is a bit misleading. The thing that gets locked is the object's variable
pool for a particular scope, not all of the variables for the object. For example, two different
threads might have the GUARD lock on the same object at different scope levels. Knowing the scope
would be a very useful piece of information.
4) I don't like the use of the term "lock" here. At least refer to them as a GUARD lock, since
that is the concept that is used in other places.
5) I still don't like the M prefix. I think things would just be simpler if multi-thread mode is
used any time there are multiple active threads.
Thank you for the feedback!
A question ad 5): what about using M as a postfix (AM, RM, IM: on, A, R, I:
off)?
ad 1): indeed in the used example it looks redundant; maybe a different example would show both to
be benefitial as there may be different activities on the same thread, but also a single activity on
different threads. E.g. example_12_5.rex:
/* Example of sending message to SELF */
object1 = .example~new
object2 = .example~new
say object1~repeater(5, "Object 1 running")
say object2~repeater(5, "Object 2 running")
say "Main ended."
::class example
::method repeater
use arg reps,msg
reply "Entered repeater."
say self~repeat(reps,msg)
::method repeat
use arg reps,msg
do reps
say msg
end
return "Repeated" msg"," reps "times."
::options trace a
------------------------
R1 T1 A1 2 *-* object1 = .example~new
R1 T1 A1 3 *-* object2 = .example~new
R1 T1 A1 4 *-* say object1~repeater(5, "Object 1
running")
R1 T1 A2 V1 >I> Method "REPEATER" with scope "EXAMPLE" in
package "G:\oorexx.tmp\concurrencyTrace\example_12_5.rex".
R1 T1 A2 V1 1* 10 *-* use arg reps,msg
R1 T1 A2 V1 1* 11 *-* reply "Entered repeater."
Entered repeater.
R1 T1 A1 5 *-* say object2~repeater(5, "Object 2
running")
/R1 T2 A2 V1 1* >I> Method "REPEATER" with scope "EXAMPLE" in package
"G:\oorexx.tmp\concurrencyTrace\example_12_5.rex"./
R1 T1 A3 V2 >I> Method "REPEATER" with scope "EXAMPLE" in
package "G:\oorexx.tmp\concurrencyTrace\example_12_5.rex".
/R1 T2 A2 V1 1* 12 *-* say self~repeat(reps,msg)/
R1 T1 A3 V2 1* 10 *-* use arg reps,msg
/R1 T2 A4 V1 1 >I> Method "REPEAT" with scope "EXAMPLE" in package
"G:\oorexx.tmp\concurrencyTrace\example_12_5.rex"./
R1 T1 A3 V2 1* 11 *-* reply "Entered repeater."
/R1 T2 A4 V1 2* 15 *-* use arg reps,msg///Entered repeater.
/R1 T2 A4 V1 2* 16 *-* do reps///R1 T1 A1 6 *-* say "Main
ended."
Main ended.
*R1 T3 A3 V2 1* >I> Method "REPEATER" with scope "EXAMPLE" in package
"G:\oorexx.tmp\concurrencyTrace\example_12_5.rex".*
/R1 T2 A4 V1 2* 17 *-* say msg///Object 1 running
*R1 T3 A3 V2 1* 12 *-* say self~repeat(reps,msg)*
/R1 T2 A4 V1 2* 18 *-* end///*R1 T3 A5 V2 1 >I> Method "REPEAT" with scope
"EXAMPLE" in package
"G:\oorexx.tmp\concurrencyTrace\example_12_5.rex".*
/R1 T2 A4 V1 2* 16 *-* do reps///*R1 T3 A5 V2 2* 15 *-* use arg reps,msg*
/R1 T2 A4 V1 2* 17 *-* say msg///Object 1 running
*R1 T3 A5 V2 2* 16 *-* do reps*
/R1 T2 A4 V1 2* 18 *-* end///*R1 T3 A5 V2 2* 17 *-* say msg*
Object 2 running
/R1 T2 A4 V1 2* 16 *-* do reps///*R1 T3 A5 V2 2* 18 *-* end*
/R1 T2 A4 V1 2* 17 *-* say msg///Object 1 running
*R1 T3 A5 V2 2* 16 *-* do reps*
/R1 T2 A4 V1 2* 18 *-* end///*R1 T3 A5 V2 2* 17 *-* say msg*
Object 2 running
/R1 T2 A4 V1 2* 16 *-* do reps///*R1 T3 A5 V2 2* 18 *-* end*
/R1 T2 A4 V1 2* 17 *-* say msg///Object 1 running
*R1 T3 A5 V2 2* 16 *-* do reps*
/R1 T2 A4 V1 2* 18 *-* end///*R1 T3 A5 V2 2* 17 *-* say msg*
Object 2 running
/R1 T2 A4 V1 2* 16 *-* do reps///*R1 T3 A5 V2 2* 18 *-* end*
/R1 T2 A4 V1 2* 17 *-* say msg///Object 1 running
*R1 T3 A5 V2 2* 16 *-* do reps*
/R1 T2 A4 V1 2* 18 *-* end///*R1 T3 A5 V2 2* 17 *-* say msg*
Object 2 running
/R1 T2 A4 V1 2* 16 *-* do reps///*R1 T3 A5 V2 2* 18 *-* end*
/R1 T2 A4 V1 2* 19 *-* return "Repeated" msg"," reps "times."///Repeated
Object 1 running, 5 times.
*R1 T3 A5 V2 2* 16 *-* do reps****R1 T3 A5 V2 2* 17 *-* say msg*
Object 2 running
*R1 T3 A5 V2 2* 18 *-* end****R1 T3 A5 V2 2* 16 *-* do reps****R1 T3 A5 V2 2* 19 *-* return
"Repeated" msg"," reps "times."*
Repeated Object 2 running, 5 times.
------------------------
So in T1 three actvities get executed (A1, A2, A3), in T2 A2 and A4, in T3 A3 and A5. One can see in
T1 for how long A2 and A3 get executed there and where they switched to T2 and T3 and which
activities got invoked on them.
---rony
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel