12 #ifndef ECL_THREADS_PRIORITY_POS_HPP_
13 #define ECL_THREADS_PRIORITY_POS_HPP_
19 #include <ecl/config/ecl.hpp>
20 #if defined(ECL_IS_POSIX)
30 #include <sys/resource.h>
31 #include <ecl/config/ecl.hpp>
120 std::string
ECL_PUBLIC print_priority_diagnostics();
143 bool ECL_LOCAL set_real_time_priority(
int policy,
int priority_level);
152 #if defined(ECL_HAS_EXCEPTIONS)
171 inline StandardException
ECL_LOCAL throwPriorityException(
const char* loc ) {
172 int error_result = errno;
173 switch (error_result) {
174 case ( EINVAL ) :
return StandardException(loc,
ecl::InvalidInputError,
"The specified param structure or priority group was invalid.");
175 case ( ESRCH ) :
return StandardException(loc,
ecl::InvalidInputError,
"The process specified could not be found.");
176 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).");
177 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).");
180 std::ostringstream ostream;
181 ostream <<
"Unknown posix error " << error_result <<
": " << strerror(error_result) <<
".";
182 return StandardException(loc,
UnknownError, ostream.str());