]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fiber/src/numa/freebsd/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"
11 #include <sys/param.h>
12 #include <sys/cpuset.h>
15 #include <system_error>
17 #ifdef BOOST_HAS_ABI_HEADERS
18 # include BOOST_ABI_PREFIX
26 void pin_thread( std::uint32_t cpu_id
) {
29 CPU_SET( cpu_id
, & mask
);
30 if ( BOOST_UNLIKELY( 0 != ::cpuset_setaffinity( CPU_LEVEL_WHICH
, CPU_WHICH_TID
, -1, sizeof( mask
), & mask
) ) ) {
31 throw std::system_error(
32 std::error_code( errno
, std::system_category() ),
33 "::cpuset_setaffinity() failed");
39 #ifdef BOOST_HAS_ABI_HEADERS
40 # include BOOST_ABI_SUFFIX