An error on trying to sort shared data using slice

bearophile bearophileHUGS at lycos.com
Mon Jan 28 07:20:02 PST 2013


Sparsh Mittal:

> Thanks for your reply and link (which I will try to follow).

Good.


> However, I am trying to write a parallel program where I have a 
> big array. Multiple (e.g. 2, 4, 8) threads do work on part of 
> those arrays. Afterwards, they sort their portions of array and 
> return the answer to main.
>
> So, I have made global variable, which is shared array. I do 
> not know if there is another way to tackle the problem.

This shows one solution using many mutexes, but using only fewer 
of them is probably enough:
http://rosettacode.org/wiki/Atomic_updates#D

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list