added Thread::sleep() wrappers

This commit is contained in:
hyung-hwan 2019-03-12 07:23:41 +00:00
parent 17dcf4feb5
commit c5c9c47e86
2 changed files with 13 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#define _QSE_SI_THREAD_CLASS_ #define _QSE_SI_THREAD_CLASS_
#include <qse/si/thr.h> #include <qse/si/thr.h>
#include <qse/si/os.h>
#include <qse/Uncopyable.hpp> #include <qse/Uncopyable.hpp>
#include <qse/cmn/Mmged.hpp> #include <qse/cmn/Mmged.hpp>
@ -88,6 +89,17 @@ public:
int blockAllSignals () QSE_CPP_NOEXCEPT { return qse_thr_blockallsigs(&this->thr); } int blockAllSignals () QSE_CPP_NOEXCEPT { return qse_thr_blockallsigs(&this->thr); }
int unblockAllSignals () QSE_CPP_NOEXCEPT { return qse_thr_unblockallsigs(&this->thr); } int unblockAllSignals () QSE_CPP_NOEXCEPT { return qse_thr_unblockallsigs(&this->thr); }
void sleep (const qse_ntime_t* duration) QSE_CPP_NOEXCEPT
{
qse_sleep (duration);
}
void sleep (unsigned int seconds) QSE_CPP_NOEXCEPT
{
static qse_ntime_t duration = { seconds, 0 };
qse_sleep (&duration);
}
protected: protected:
qse_thr_t thr; qse_thr_t thr;
void* __exctx; void* __exctx;

View File

@ -203,7 +203,7 @@ void App::sleep (const qse_ntime_t* duration) QSE_CPP_NOEXCEPT
void App::sleep (unsigned int seconds) QSE_CPP_NOEXCEPT void App::sleep (unsigned int seconds) QSE_CPP_NOEXCEPT
{ {
static qse_ntime_t duration = { seconds, 0 }; qse_ntime_t duration = { seconds, 0 };
qse_sleep (&duration); qse_sleep (&duration);
} }