www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - running pure functions in parallel

reply Justin <justin economicmodeling.com> writes:
I'm designing an application which needs to process a lot of data as quickly as
possible. I've found that I can engineer the processing algorithms into pure
functions which can operate on different segments of my data. I would like to
run these functions in parallel but:

spawn() precludes returning a value
the docs seem to be silent on the possibility of using out parameters

Do I have to use messaging passing to get a value out of a pure function being
run in a separate thread?
Aug 03 2010
parent "Simen kjaeraas" <simen.kjaras gmail.com> writes:
Justin <justin economicmodeling.com> wrote:

 I'm designing an application which needs to process a lot of data as  
 quickly as
 possible. I've found that I can engineer the processing algorithms into  
 pure
 functions which can operate on different segments of my data. I would  
 like to
 run these functions in parallel but:

 spawn() precludes returning a value
 the docs seem to be silent on the possibility of using out parameters

 Do I have to use messaging passing to get a value out of a pure function  
 being
 run in a separate thread?
Currently, the D standard library (phobos) does not support futures, but David Simcha's parallelFuture does: http://dsource.org/projects/scrapple/browser/trunk/parallelFuture I would believe this is roughly what you're looking for. -- Simen
Aug 03 2010