mirror of https://github.com/Icinga/icinga2.git
Removed ::Sleep and implemented Utility::Sleep.
This commit is contained in:
parent
e1fc41e735
commit
edf812b6b5
|
@ -138,7 +138,7 @@ void Application::TimeWatchThreadProc(void)
|
|||
double lastLoop = Utility::GetTime();
|
||||
|
||||
for (;;) {
|
||||
Sleep(5000);
|
||||
Utility::Sleep(5);
|
||||
|
||||
double now = Utility::GetTime();
|
||||
double timeDiff = lastLoop - now;
|
||||
|
|
|
@ -81,7 +81,7 @@ void Process::WorkerThreadProc(void)
|
|||
tv.tv_usec = 0;
|
||||
select(nfds + 1, &readfds, NULL, NULL, &tv);
|
||||
#else /* _MSC_VER */
|
||||
Sleep(1000);
|
||||
Utility::Sleep(1);
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
for (it = tasks.begin(); it != tasks.end(); ) {
|
||||
|
|
|
@ -20,20 +20,9 @@
|
|||
#include "i2-base.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <ltdl.h>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* Sleeps for the specified amount of time.
|
||||
*
|
||||
* @param milliseconds The amount of time in milliseconds.
|
||||
*/
|
||||
void Sleep(unsigned long milliseconds)
|
||||
{
|
||||
usleep(milliseconds * 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes a socket.
|
||||
*
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
#include <sys/file.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
void Sleep(unsigned long milliseconds);
|
||||
|
||||
typedef int SOCKET;
|
||||
#define INVALID_SOCKET (-1)
|
||||
void closesocket(SOCKET fd);
|
||||
|
|
|
@ -309,3 +309,18 @@ pid_t Utility::GetPid(void)
|
|||
return GetCurrentProcessId();
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Sleeps for the specified amount of time.
|
||||
*
|
||||
* @param timeout The timeout in seconds.
|
||||
*/
|
||||
void Utility::Sleep(double timeout)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
usleep(timeout * 1000 * 1000);
|
||||
#else /* _WIN32 */
|
||||
Sleep(timeout * 1000);
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
|
||||
static pid_t GetPid(void);
|
||||
|
||||
static void Sleep(double timeout);
|
||||
|
||||
private:
|
||||
static bool m_SSLInitialized;
|
||||
|
||||
|
|
Loading…
Reference in New Issue