Computer Science Canada

process problem

Author:  fabulos [ Sun May 08, 2005 12:23 pm ]
Post subject:  process problem

if u make a process with variables, eg x := 2

and then later when u call that process, after x has changed many times, how do u make sure that the x in the process has also changed?

Author:  Delos [ Sun May 08, 2005 12:31 pm ]
Post subject: 

If 'x' is global, then it will change independant of the process. If 'x' is local, then I suggest using parameters within your process to control 'x' externally.

So...

Turing:

var x : int := 0

process a
%...
x += 2
end a

fork a
% x is independant of a


Turing:

process a (var inVar : int)
var x : int := inVar
%...
x += 2
end a

var control : int := 0
fork a(control)
% x is local to a, but externally controlled.


: