[otj-users] Teams, Threads and Within: how to deal with them;

Henry Sudhof hsudhof at cs.tu-berlin.de
Wed Oct 12 14:35:28 CEST 2005


Hi, again.
It seems like the formatting of the second scenario didn't  translate 
well to email, here it is again:

----------------------------------------------------------------------
Assume a program running in two threads: t1 and t2 sharing one team x of 
the type X. A has a bound role with a callin on a base class B's method 
m. Let b be an instance of B.

The events occur in this order:


Thread t1 enters a synchronized block for x

Thread t1 enters a within block for x

Thread t2 calls b.m . As t1 has the lock on x, neither the callin nor 
the method will  be executed yet

Thread t1 leaves the within block. x will be deactivated

Thread t1 leaves the synchronized block.

t2 obtains the lock on x The callin for b.m gets executed in t2, despite 
x being no longer active. This causes implicit activation of x (!).



This shows  somewhat of a grey area regarding  §5.3. : implicit 
activation can happen without externalized roles and/or team-level 
methods as well.
Also, this means that a team might become become active, despite no 
other thread activating it explicitely (not even implicitly).

----------------------------------------------------------------------
H




More information about the otj-users mailing list