added qse_msleep()
This commit is contained in:
parent
d41f8e75e0
commit
e61b34b17b
@ -59,6 +59,7 @@ public:
|
||||
|
||||
void sleep (const qse_ntime_t* duration) QSE_CPP_NOEXCEPT;
|
||||
void sleep (unsigned int seconds) QSE_CPP_NOEXCEPT;
|
||||
void msleep (qse_mtime_t duration) QSE_CPP_NOEXCEPT;
|
||||
|
||||
#if 0
|
||||
int switchUser (qse_uid_t uid, qse_gid_t gid, bool permanently) QSE_CPP_NOEXCEPT;
|
||||
|
@ -99,6 +99,11 @@ public:
|
||||
static qse_ntime_t duration = { seconds, 0 };
|
||||
qse_sleep (&duration);
|
||||
}
|
||||
|
||||
void msleep (qse_mtime_t duration) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
qse_msleep (duration);
|
||||
}
|
||||
|
||||
protected:
|
||||
qse_thr_t thr;
|
||||
|
@ -42,6 +42,10 @@ QSE_EXPORT void qse_sleep (
|
||||
const qse_ntime_t* interval
|
||||
);
|
||||
|
||||
QSE_EXPORT void qse_msleep (
|
||||
const qse_mtime_t interval
|
||||
);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -207,6 +207,11 @@ void App::sleep (unsigned int seconds) QSE_CPP_NOEXCEPT
|
||||
qse_sleep (&duration);
|
||||
}
|
||||
|
||||
void App::msleep (const qse_mtime_t duration) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
qse_msleep (duration);
|
||||
}
|
||||
|
||||
#if 0
|
||||
int App::switchPrivilege (int gid, int uid, bool permanently)
|
||||
{
|
||||
|
@ -56,6 +56,23 @@ void qse_sleep (const qse_ntime_t* interval)
|
||||
#endif
|
||||
}
|
||||
|
||||
void qse_msleep (qse_mtime_t interval)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
Sleep (interval);
|
||||
#elif defined(__OS2__)
|
||||
DosSleep (interval);
|
||||
#elif defined(HAVE_NANOSLEEP)
|
||||
struct timespec ts;
|
||||
ts.tv_sec = QSE_MSEC_TO_SEC(interval);
|
||||
interval -= QSE_SEC_TO_MSEC(ts.tv_sec);
|
||||
ts.tv_nsec = QSE_MSEC_TO_NSEC(interval);
|
||||
nanosleep (&ts, &ts);
|
||||
#else
|
||||
sleep (QSE_MSEC_TO_SEC(interval));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
TODO:
|
||||
int qse_set_proc_name (const qse_char_t* name)
|
||||
|
Loading…
Reference in New Issue
Block a user