12 #ifndef ECL_TIME_SLEEP_POS_HPP_ 13 #define ECL_TIME_SLEEP_POS_HPP_ 19 #include <ecl/config.hpp> 20 #if defined(ECL_IS_POSIX) 29 #include <ecl/config/macros.hpp> 30 #include <ecl/exceptions/macros.hpp> 31 #include <ecl/exceptions/standard_exception.hpp> 32 #include "duration.hpp" 82 Sleep(
const unsigned long &seconds = 0);
124 timespec required, remaining;
153 MilliSleep(
const unsigned long &milliseconds = 0);
155 virtual ~MilliSleep() {}
185 timespec required, remaining;
214 MicroSleep(
const unsigned long µseconds = 0);
216 virtual ~MicroSleep() {}
246 timespec required, remaining;
275 NanoSleep(
const unsigned long &nanoseconds = 0);
277 virtual ~NanoSleep() {}
307 timespec required, remaining;
317 #if defined(ECL_HAS_EXCEPTIONS) 332 int error_result = errno;
333 switch (error_result) {
334 case ( EINTR ) :
return StandardException(loc,
ecl::InterruptedError,
"A posix signal interrupted the sleep.");
335 case ( EINVAL ) :
return StandardException(loc,
ecl::InvalidInputError,
"Specified value was negative or exceeded resolution range.\n\n Sleep: [N/A]\n MilliSleep: [0-1000]\n MicroSleep: [0-1x10^6]\n NanoSleep: [0-1x10^9]\n");
336 case ( EFAULT ) :
return StandardException(loc,
ecl::MemoryError,
"Internal posix issue copying information from user space.");
339 std::ostringstream ostream;
340 ostream <<
"Unknown posix error " << error_result <<
": " << strerror(error_result) <<
".";
341 return StandardException(loc,
UnknownError, ostream.str());
Standard exception type, provides code location and error string.
#define ecl_assert_throw_decl(exception)
Assure throw exception declaration.