]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fiber/src/numa/linux/pin_thread.cpp
2 // Copyright Oliver Kowalke 2017.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #include "boost/fiber/numa/pin_thread.hpp"
14 #include <system_error>
16 #ifdef BOOST_HAS_ABI_HEADERS
17 # include BOOST_ABI_PREFIX
25 void pin_thread( std::uint32_t cpuid
) {
28 CPU_SET( cpuid
, & set
);
30 if ( BOOST_UNLIKELY( 0 != ( err
= ::pthread_setaffinity_np( ::pthread_self(), sizeof( set
), & set
) ) ) ) {
31 throw std::system_error(
32 std::error_code( err
, std::system_category() ),
33 "pthread_setaffinity_np() failed");
39 #ifdef BOOST_HAS_ABI_HEADERS
40 # include BOOST_ABI_SUFFIX