|
LCS-2016-033 |
|
2 {11-Feb-2017} 1 {26-Dec-2016} |
|
11-Feb-2017 |
|
Voting |
|
Jim Lewis |
|
Main.JimLewis |
|
Composition with Protected Types |
|
history |
|
Composition with Protected Types |
type PT is protected shared variable v1 : some_PT1; shared variable v2 : some_PT2; procedure p; end protected; -- body declaration shared variable sv : PT;One process can call a method on
sv.v1
, wheres another one can call a method on sv.v2
, and a third one can call a method on sv
--- all at the same time!
Is this what you want?
-- Martin Zabel - 2017-01-29
@MZ No. That would be bad as there can be dependencies that result in deadlock. If the prefix contains sv, we can restrict it in the same way that calls to methods are restricted. In addition, we would need to forbid the creation of pointers to sv.v1 and sv.v2 - ie if 014b comes to fruition, then we need to disallow it here.
-- Jim Lewis - 2017-01-31
@MZ Reflecting on your example, it is safe to call sv.v1.a1 and sv.v2.b1 simultaneously since they are independent objects. However, the method p may also call a method of v1 or v2. As a result, if a method of sv.v1 is called, it must lock sv in order to prevent calls to method p.
This all becomes a mute point with version 2 since the variable are no longer visible - only aliases to methods within the variables are visible. Hence, there is no longer a sense of independent variables - and perhaps that is exactly how it should be.
-- Jim Lewis - 2017-02-11
Updated to revision 2. Variables are now private and required to be labeled as such.
-- Jim Lewis - 2017-02-11
I think the following sentence should be more specific: