]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fiber/src/numa/solaris/pin_thread.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / fiber / src / numa / solaris / pin_thread.cpp
1
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)
6
7 #include "boost/fiber/numa/pin_thread.hpp"
8
9 extern "C" {
10 #include <errno.h>
11 #include <sys/types.h>
12 #include <sys/processor.h>
13 #include <sys/procset.h>
14 }
15
16 #include <system_error>
17
18 #ifdef BOOST_HAS_ABI_HEADERS
19 # include BOOST_ABI_PREFIX
20 #endif
21
22 namespace boost {
23 namespace fibers {
24 namespace numa {
25
26 BOOST_FIBERS_DECL
27 void pin_thread( std::uint32_t cpuid) {
28 if ( BOOST_UNLIKELY( -1 == ::processor_bind( P_LWPID,
29 P_MYID,
30 static_cast< processorid_t >( cpuid),
31 0) ) ) {
32 throw std::system_error(
33 std::error_code( errno, std::system_category() ),
34 "processor_bind() failed");
35 }
36 }
37
38 }}}
39
40 #ifdef BOOST_HAS_ABI_HEADERS
41 # include BOOST_ABI_SUFFIX
42 #endif