priority_win.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef ECL_THREADS_PRIORITY_WIN_HPP_
00013 #define ECL_THREADS_PRIORITY_WIN_HPP_
00014 
00015 /*****************************************************************************
00016 ** Platform Check
00017 *****************************************************************************/
00018 
00019 #include <ecl/config/ecl.hpp>
00020 #if defined(ECL_IS_WIN32)
00021 
00022 /*****************************************************************************
00023 ** Includes
00024 *****************************************************************************/
00025 
00026 #include <windows.h>
00027 #include <string>
00028 #include <sstream>
00029 #include <errno.h>
00030 #include <ecl/config/ecl.hpp>
00031 #include <ecl/exceptions/macros.hpp>
00032 #include <ecl/exceptions/standard_exception.hpp>
00033 #include "priority_common.hpp"
00034 #include "macros.hpp"
00035 
00036 /*****************************************************************************
00037 ** Namespaces
00038 *****************************************************************************/
00039 
00040 namespace ecl {
00041 
00065 bool ecl_threads_PUBLIC set_priority(Priority priority_level) ecl_debug_throw_decl(StandardException);
00072 Priority ecl_threads_PUBLIC get_priority() ecl_debug_throw_decl(StandardException);
00073 
00079 std::string ecl_threads_PUBLIC print_priority_diagnostics() ecl_debug_throw_decl(StandardException);
00080 
00081 /*****************************************************************************
00082 ** Namespace
00083 *****************************************************************************/
00084 
00085 namespace threads {
00086 
00102 bool ECL_LOCAL set_real_time_priority(int policy,int priority_level) ecl_debug_throw_decl(StandardException);
00103 
00104 } // namespace threads
00105 } // namespace ecl
00106 
00107 /*****************************************************************************
00108 ** Interface [Exceptions]
00109 *****************************************************************************/
00110 
00111 #if defined(ECL_HAS_EXCEPTIONS)
00112 namespace ecl {
00113 namespace threads {
00114 
00115 /*****************************************************************************
00116 ** Interface [Priority Exceptions]
00117 *****************************************************************************/
00130 inline StandardException ECL_LOCAL throwPriorityException(const char* loc ) {
00131         int error_result = errno;
00132     switch (error_result) {
00133         case ( EINVAL ) : return StandardException(loc, ecl::InvalidInputError, "The specified param structure or priority group was invalid.");
00134         case ( ESRCH  ) : return StandardException(loc, ecl::InvalidInputError, "The process specified could not be found.");
00135         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).");
00136         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).");
00137                 default         :
00138                 {
00139                         std::ostringstream ostream;
00140                         ostream << "Unknown posix error " << error_result << ": " << strerror(error_result) << ".";
00141                         return StandardException(loc, UnknownError, ostream.str());
00142                 }
00143     }
00144 }
00145 
00146 
00147 }; // namespace threads
00148 } // namespace ecl
00149 #endif /* ECL_HAS_EXCEPTIONS */
00150 #endif /* ECL_IS_WIN32 */
00151 #endif /* ECL_THREADS_PRIORITY_WIN_HPP_ */


ecl_threads
Author(s): Daniel Stonier
autogenerated on Mon Jul 3 2017 02:22:01