BOOST_FIBERS_DECL
void pin_thread( std::uint32_t cpuid) {
+ pin_thread( cpuid, ::pthread_self() );
+}
+
+BOOST_FIBERS_DECL
+void pin_thread( std::uint32_t cpuid, std::thread::native_handle_type h) {
cpu_set_t set;
CPU_ZERO( & set);
CPU_SET( cpuid, & set);
int err = 0;
- if ( BOOST_UNLIKELY( 0 != ( err = ::pthread_setaffinity_np( ::pthread_self(), sizeof( set), & set) ) ) ) {
+ if ( BOOST_UNLIKELY( 0 != ( err = ::pthread_setaffinity_np( h, sizeof( set), & set) ) ) ) {
throw std::system_error(
std::error_code( err, std::system_category() ),
"pthread_setaffinity_np() failed");