mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
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();
|
double lastLoop = Utility::GetTime();
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
Sleep(5000);
|
Utility::Sleep(5);
|
||||||
|
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
double timeDiff = lastLoop - now;
|
double timeDiff = lastLoop - now;
|
||||||
|
@ -81,7 +81,7 @@ void Process::WorkerThreadProc(void)
|
|||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
select(nfds + 1, &readfds, NULL, NULL, &tv);
|
select(nfds + 1, &readfds, NULL, NULL, &tv);
|
||||||
#else /* _MSC_VER */
|
#else /* _MSC_VER */
|
||||||
Sleep(1000);
|
Utility::Sleep(1);
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
for (it = tasks.begin(); it != tasks.end(); ) {
|
for (it = tasks.begin(); it != tasks.end(); ) {
|
||||||
|
@ -20,20 +20,9 @@
|
|||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <ltdl.h>
|
|
||||||
|
|
||||||
using namespace icinga;
|
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.
|
* Closes a socket.
|
||||||
*
|
*
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
void Sleep(unsigned long milliseconds);
|
|
||||||
|
|
||||||
typedef int SOCKET;
|
typedef int SOCKET;
|
||||||
#define INVALID_SOCKET (-1)
|
#define INVALID_SOCKET (-1)
|
||||||
void closesocket(SOCKET fd);
|
void closesocket(SOCKET fd);
|
||||||
|
@ -309,3 +309,18 @@ pid_t Utility::GetPid(void)
|
|||||||
return GetCurrentProcessId();
|
return GetCurrentProcessId();
|
||||||
#endif /* _WIN32 */
|
#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 pid_t GetPid(void);
|
||||||
|
|
||||||
|
static void Sleep(double timeout);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool m_SSLInitialized;
|
static bool m_SSLInitialized;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user