From c5c9c47e86ab320bb18885f77c4db7679db93164 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 12 Mar 2019 07:23:41 +0000 Subject: [PATCH] added Thread::sleep() wrappers --- qse/include/qse/si/Thread.hpp | 12 ++++++++++++ qse/lib/si/App.cpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/qse/include/qse/si/Thread.hpp b/qse/include/qse/si/Thread.hpp index 61942850..ecb49f53 100644 --- a/qse/include/qse/si/Thread.hpp +++ b/qse/include/qse/si/Thread.hpp @@ -28,6 +28,7 @@ #define _QSE_SI_THREAD_CLASS_ #include +#include #include #include @@ -88,6 +89,17 @@ public: int blockAllSignals () QSE_CPP_NOEXCEPT { return qse_thr_blockallsigs(&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: qse_thr_t thr; void* __exctx; diff --git a/qse/lib/si/App.cpp b/qse/lib/si/App.cpp index ac0d64a1..26d13d6b 100644 --- a/qse/lib/si/App.cpp +++ b/qse/lib/si/App.cpp @@ -203,7 +203,7 @@ void App::sleep (const qse_ntime_t* duration) 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); }