vicente.botet wrote:
Hi, ----- Original Message ----- From: "Lennyk"
To: Sent: Sunday, February 15, 2009 6:14 PM Subject: [Boost-users] Setting thread affinity on Linux using boost::thread Hi,
I'm running on Linux and I would like to set a specific thread affinity to each thread I create (i.e. setting each thread to run on a different core/CPU). How can this be done using the boost::thread library?
Oliver Kowalke, the author of the Boost.ThreadPool has posted a compressed file boost-bind_processor.v1.tar.gz in Boost Vault http://www.boostpro.com/vault/index.php?directory=Concurrent%20Programming&PHPSESSID=96307fee8086c06036af42fae790b449
This file contains functions which allows bind/unbind current thread to a processor
boost::this_thread::bind_to_processor( unsigned int n); // thread gets bound to processor n
boost::this_thread::bind_to_any_processor(); // thread can be scheduled to all available processors
Both functions will throw boost::system_error. Processors are enumerated starting at 0.
HTH, Vicente
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Great! Thanks! Lenny