Boost logo

Boost Users :

From: James Sutherland (James.Sutherland_at_[hidden])
Date: 2008-02-05 16:07:26


I have tried threadpool. It is my understanding that the code fragment
below should run in constant time independent of the number of threads
(assuming that the ³Test::operator()² method runs in constant time).
However, I observe an increase in runtime as I increase the pool size from
say 1 to 5.

Any thoughts on this?

James

> int main()
> {
> const int nt = 5;
> const int nit = 10000;
>
> time_t t1 = clock();
>
> boost::threadpool::pool p(1);
> for( int j=0; j<nit; ++j ){
> for( int i=0; i<nt; ++i ){
> p.schedule( Test(i) );
> }
> p.wait();
> }
>
> std::cout << "t=" << difftime(clock(), t1) << std::endl;
> return 0;
> }



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net