in Programming language course my professor take an example.
Suppose the following code:
int x=initialization();
Thread T1=new computethread(x);
Thread t2=new evaluatethread(x);
...
...
Thread t100=new evaluatethread(x);
threads t1
to t100
needs the initial value of variable x
for their computation and t1
need to change the x
, which transfer of parameter for computethread
, evaluatethread
is preferred?
my professor say:
1) call by value result
2) call by ref
is preferred for sending x to computethread
, evaluatethread
, why call by result or call by name or this order like 2) call by value result, 1) call by ref is not preferred?
why he conclude these are better?