Boost logo

Boost Users :

Subject: Re: [Boost-users] Using boost::thread to keep all cores busy
From: Internet Retard (webretard_at_[hidden])
Date: 2010-07-26 12:10:34


  

What is the correct way to determine the number of running/busy threads
(thread_count)?

I think you need to go buy a basic book on threaded programming.

This list is not that book.

----
Not sure the reason for that comment. Mine seems a logical approach and is almost working. My only other experience with threading was with Python and it had a similar method called threading.active_count()
So my logic (while maybe wrong) is to:
1. Get the number of cores using boost::thread::hardware_concurrency()
2. Fill a std::queue container with jobs for the threads.
3. While the container is not empty and there are less active threads than boost::thread::hardware_concurrency(), then start a new thread.
Again, not sure why that would be deserving of a condescending response, it seems logical.
 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969


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