Boost logo

Boost Users :

Subject: Re: [Boost-users] Setting thread affinity on Linux using boost::thread
From: Lennyk (lennyk430_at_[hidden])
Date: 2009-02-18 11:19:35


vicente.botet wrote:
> Hi,
> ----- Original Message -----
> From: "Lennyk" <lennyk430_at_[hidden]>
> To: <boost-users_at_[hidden]>
> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
Great! Thanks!
Lenny


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