Multithreaded file IO?

Christophe travert at phare.normalesup.org
Mon Sep 26 03:02:59 PDT 2011


Jerry Quinn , dans le message (digitalmars.D.learn:29763), a écrit :
> Lutger Blijdestijn Wrote:
> 
>> If you didn't know, the concurrency chapter of tdpl is a free chapter: 
>> http://www.informit.com/articles/article.aspx?p=1609144
>> 
>> It has an example of file copying with message passing: 
>> http://www.informit.com/articles/article.aspx?p=1609144&seqNum=7
> 
> What I really want is a shared fifo where the input is lines from a 
> file, and many workers grab something from the fifo.  They then push 
> their results into a shared reordering output queue.

My 2 cent advice:

Does the queue really has to be a file ?
You could read it completely before starting, and then just share 
your instructions as strings for example.

That may make your life easier.
I would actually use a file if I use multiprocessing, but not 
necessarily for multithreading.


More information about the Digitalmars-d-learn mailing list