Timon Gehr Wrote: > On 09/12/2011 07:23 PM, Jerry Quinn wrote: > > I'm looking at porting an app that maintains a work queue to be processed > > by one of N engines and written out in order. At first glance, > > std.parallelism already provides the queue, but the Task concept appears to > > assume that there's no startup cost per thread. > > > > Am I missing something or do I need to roll a shared queue object? > > I don't know if I get you right, but std.parallelism uses a task pool. > Usually no threads are started or stopped during processing.
OK I guess what I'm looking for is WorkerLocalStorage. I can create an engine per thread. However, I probably need to have each thread do the initialization work. If I create the engine on the main thread, it won't be properly accessed by the worker thread, right? I.e. I need each thread to run engine.init() which will do a whole pile of loading and setup first before I can start feeding data to the pool. The impression I get is that for (int i=0; i < nthreads; i++) taskPool.workerLocalStorage(new engine(datafile)) will not get me what I want.
