== Quote from Jerry Quinn ([email protected])'s article
> dsimcha Wrote:
> > == Quote from Jerry Quinn ([email protected])'s article
> > > 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?
> >
> > Not sure if I'm misunderstanding what you're asking, but I'll answer the 
> > question
> > I think you're asking.  std.parallelism's Task can be executed in two ways.
> > executeInNewThread() does start a new thread for every Task.  However, you 
> > can
> > also submit a Task to a TaskPool and have it executed by an existing worker
> > thread.  The whole point of using TaskPool to execute a Task is to avoid 
> > paying
> > the thread start-up cost for every Task.
> The question I was asking was how to execute a huge amount of per-thread
initialization once per thread in the TaskPool framework.

Hmm, currently there isn't an easy/obvious way, though I'm thinking maybe one
should be added.  I've kind of needed it, too, and I don't anticipate it being
very hard to implement.  If you can suggest a good API for this, I'll work on it
for next release.

Reply via email to