.. _program_listing_file__tmp_ws_src_ecl_core_ecl_threads_include_ecl_threads_priority_win.hpp: Program Listing for File priority_win.hpp ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/ecl_core/ecl_threads/include/ecl/threads/priority_win.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /***************************************************************************** ** Ifdefs *****************************************************************************/ #ifndef ECL_THREADS_PRIORITY_WIN_HPP_ #define ECL_THREADS_PRIORITY_WIN_HPP_ /***************************************************************************** ** Platform Check *****************************************************************************/ #include #if defined(ECL_IS_WIN32) /***************************************************************************** ** Includes *****************************************************************************/ #include #include #include #include #include #include #include #include "priority_common.hpp" #include "macros.hpp" /***************************************************************************** ** Namespaces *****************************************************************************/ namespace ecl { bool ecl_threads_PUBLIC set_priority(Priority priority_level); Priority ecl_threads_PUBLIC get_priority(); std::string ecl_threads_PUBLIC print_priority_diagnostics(); /***************************************************************************** ** Namespace *****************************************************************************/ namespace threads { bool ECL_LOCAL set_real_time_priority(int policy,int priority_level); } // namespace threads } // namespace ecl /***************************************************************************** ** Interface [Exceptions] *****************************************************************************/ #if defined(ECL_HAS_EXCEPTIONS) namespace ecl { namespace threads { /***************************************************************************** ** Interface [Priority Exceptions] *****************************************************************************/ inline StandardException ECL_LOCAL throwPriorityException(const char* loc ) { int error_result = errno; switch (error_result) { case ( EINVAL ) : return StandardException(loc, ecl::InvalidInputError, "The specified param structure or priority group was invalid."); case ( ESRCH ) : return StandardException(loc, ecl::InvalidInputError, "The process specified could not be found."); case ( EPERM ) : return StandardException(loc, ecl::PermissionsError, "The caller does not have the appropriate privileges for realtime scheduling (http://snorriheim.dnsdojo.com/doku/doku.php/en:linux:admin:priorities)."); case ( EACCES ) : return StandardException(loc, ecl::PermissionsError, "The caller does not have the appropriate privileges for elevating the process priority by reducing the niceness value (http://snorriheim.dnsdojo.com/doku/doku.php/en:linux:admin:priorities)."); default : { std::ostringstream ostream; ostream << "Unknown posix error " << error_result << ": " << strerror(error_result) << "."; return StandardException(loc, UnknownError, ostream.str()); } } } }; // namespace threads } // namespace ecl #endif /* ECL_HAS_EXCEPTIONS */ #endif /* ECL_IS_WIN32 */ #endif /* ECL_THREADS_PRIORITY_WIN_HPP_ */