|
Boost : |
Subject: Re: [boost] [threadpool] version 22 with default pool
From: k-oli_at_[hidden]
Date: 2009-03-08 15:19:58
Am Sunday 08 March 2009 19:48:11 schrieb Edouard A.:
> I have implemented a parallel_sort that is a bit slower than tbb with
> threadpool (see below for the code).
threadpool uses a signle-lock global queue - if a thread enters the queue for
enqueing/dequeing a task it aquires the lock so no other thread can enter the
queue. with a lock-free implementation it should work faster.
> * shutdown() renders the thread pool unusable (marks it terminated). This
> is not what I was looking for. Ideally, a wait() method that just waits for
> the pool to have no tasks left to process would be better. I would find it
> cumbersome to manually wait for the result of each task. My 2c.
pool::shutdown() is not correct - use boost::wait_for_all() or
boost::wait_for_any() from the future lib from Anthony WIlliams (I've added
the lib to threadpool archive).
task< int > tsk1 = pool.submit(...);
task< string > tsk2 = pool.submit(...);
task< int > tsk3 = pool.submit(...);
wait_for_all( tsk1.result(), tsk2.result(), tsk3.result());
// here all tasks are finsihed
> * Instrumentation seems to show that the _entry method of the pool is
> extremely slow. I have not investigated further.
the pool::entry_ method is entered by boost::thread only on startup and will
only left if the worker-thread terminates
Oliver
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk