bind_processor_solaris.cpp 632 B

1234567891011121314151617181920212223242526
  1. // Copyright Oliver Kowalke 2009.
  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/types.h>
  9. #include <sys/processor.h>
  10. #include <sys/procset.h>
  11. }
  12. #include <stdexcept>
  13. #include <boost/config/abi_prefix.hpp>
  14. void bind_to_processor( unsigned int n)
  15. {
  16. if ( ::processor_bind( P_LWPID, P_MYID, static_cast< processorid_t >( n), 0) == -1)
  17. throw std::runtime_error("::processor_bind() failed");
  18. }
  19. #include <boost/config/abi_suffix.hpp>