I have a large data object that needs to be privatized among iterations of a 
foreach (or ateach) loop. The work of each iteration of the loop is independent 
of the others and the object would normally be used for each iteration if 
executed sequentially. Something like:

> var obj: MyObject = new MyObject();
> obj.init();
> ...
> 
> for  (i in distribution){
>       doWork( obj );
> }

I tried making an array of obj objects and let each iteration work on one 
object in the array. This didn't seem to work. Each obj in the array reported 
the same memory address and the fields in the obj elements seemed to have data 
races.

I thought the right approach would be: 


> var obj: MyObject = new MyObject();
> obj.init();
> ...
> val o = obj;
> 
> finish foreach (i in distribution){
>       doWork( obj );
> }

but this didn't work either. 

Any help is appreciated.

Jim
------------------------------------------------------------------------------

_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to