double lastLoop = Utility::GetTime();
for (;;) {
- Sleep(5000);
+ Utility::Sleep(5);
double now = Utility::GetTime();
double timeDiff = lastLoop - now;
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(); ) {
#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.
*
#include <sys/file.h>
#include <sys/wait.h>
-void Sleep(unsigned long milliseconds);
-
typedef int SOCKET;
#define INVALID_SOCKET (-1)
void closesocket(SOCKET fd);
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 */
+}
+
static pid_t GetPid(void);
+ static void Sleep(double timeout);
+
private:
static bool m_SSLInitialized;