bind_processor_aix.cpp 609 B

12345678910111213141516171819202122232425
  1. // Copyright Oliver Kowalke 2014.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include "bind_processor.hpp"
  6. extern "C"
  7. {
  8. #include <sys/processor.h>
  9. #include <sys/thread.h>
  10. }
  11. #include <stdexcept>
  12. #include <boost/config/abi_prefix.hpp>
  13. void bind_to_processor( unsigned int n)
  14. {
  15. if ( ::bindprocessor( BINDTHREAD, ::thread_yield(), static_cast< cpu_t >( n) ) == -1)
  16. throw std::runtime_error("::bindprocessor() failed");
  17. }
  18. #include <boost/config/abi_suffix.hpp>