[thread_group] How to limit the number of simultaneous threads
Hi all, I would like to add some multithreading in my application. Suppose I have a set of m tasks to do, and I want to limit the number of simultaneous threads to n. I have really no idea on how to do this and would like to have some hints. Could you help me? Regards
I would like to add some multithreading in my application. Suppose I have a set of m tasks to do, and I want to limit the number of simultaneous threads to n. I have really no idea on how to do this and would like to have some hints. Could you help me?
thread_group is just a convenient container for thread objects. What you need is thread pool, like this: http://threadpool.sourceforge.net/
Thanks Igor. This is exactly what I was looking for.
Regards
2012/7/16 Igor R
I would like to add some multithreading in my application. Suppose I have a set of m tasks to do, and I want to limit the number of simultaneous threads to n. I have really no idea on how to do this and would like to have some hints. Could you help me?
thread_group is just a convenient container for thread objects. What you need is thread pool, like this: http://threadpool.sourceforge.net/ _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi there,
I downloaded the thread pool library and add the followings to the include
path of VC++ project (MS2008 on Windows XP):
C:\threadpool-0_2_5-src\threadpool
C:\boost_1_50_0
I got two compiling errors:
1>c:\threadpool-0_2_5-src\threadpool\boost\threadpool\task_adaptors.hpp(138)
: error C2065: 'TIME_UTC' : undeclared identifier
1>c:\threadpool-0_2_5-src\threadpool\boost\threadpool\task_adaptors.hpp(149)
: error C2065: 'TIME_UTC' : undeclared identifier
in just including the pool's head file in my project:
#include <iostream>
#include
Thanks Igor. This is exactly what I was looking for.
Regards
2012/7/16 Igor R
I would like to add some multithreading in my application. Suppose I have a set of m tasks to do, and I want to limit the number of simultaneous threads to n. I have really no idea on how to do this and would like to have some hints. Could you help me?
thread_group is just a convenient container for thread objects. What you need is thread pool, like this: http://threadpool.sourceforge.net/ _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Wed, Aug 08, 2012 at 06:49:36AM -0400, Boost lzw wrote:
1>c:\threadpool-0_2_5-src\threadpool\boost\threadpool\task_adaptors.hpp(138) : error C2065: 'TIME_UTC' : undeclared identifier
Whatever library responsible for providing the Boost TIME_UTC name changed it to TIME_UTC_ in a breaking change lately, due to foreseen name collisions with future standards or something. Your third party ThreadPool library may need an update in this regard. -- Lars Viklund | zao@acc.umu.se
Lars,
That fixed the compiling errors. Thank you.
Robert
On Wed, Aug 8, 2012 at 7:30 PM, Lars Viklund
On Wed, Aug 08, 2012 at 06:49:36AM -0400, Boost lzw wrote:
1>c:\threadpool-0_2_5-src\threadpool\boost\threadpool\task_adaptors.hpp(138)
: error C2065: 'TIME_UTC' : undeclared identifier
Whatever library responsible for providing the Boost TIME_UTC name changed it to TIME_UTC_ in a breaking change lately, due to foreseen name collisions with future standards or something.
Your third party ThreadPool library may need an update in this regard.
-- Lars Viklund | zao@acc.umu.se _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
Boost lzw
-
Igor R
-
Lars Viklund
-
Olivier Tournaire