Multithreaded file IO?

Christophe travert at phare.normalesup.org
Thu Sep 29 01:05:56 PDT 2011


Jerry , dans le message (digitalmars.D.learn:29830), a écrit :
> travert at phare.normalesup.org (Christophe) writes:
> 
>> Jerry Quinn , dans le message (digitalmars.D.learn:29763), a écrit :
>>> 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.
> 
> Yes, these files could be large enough that the memory cost of loading
> is an issue.  Also, I should be able to do this with input from stdin.
> 
> At this point, I'm trying to figure out how to implement a shared
> fifo in D as much as solve my original problem :-)

Ok, an idea then could be to make a separate thread that deal with the 
File object, or a big shared object well protected with a mutex, to
ditribute instructions that are as much immutable as possible.

Good luck.


More information about the Digitalmars-d-learn mailing list