From a50b453784559133d778ec845b9203e7f940726a Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Wed, 1 Nov 2023 21:16:31 +0800 Subject: [PATCH] [raknet] Implement RakSleep --- raknet/RakSleep.cpp | 18 ++++++++++++++++++ raknet/RakSleep.h | 6 ++++++ 2 files changed, 24 insertions(+) create mode 100644 raknet/RakSleep.cpp create mode 100644 raknet/RakSleep.h diff --git a/raknet/RakSleep.cpp b/raknet/RakSleep.cpp new file mode 100644 index 0000000..e4b843f --- /dev/null +++ b/raknet/RakSleep.cpp @@ -0,0 +1,18 @@ +#if defined(_COMPATIBILITY_1) +#include "Compatibility1Includes.h" +#elif defined(_WIN32) +#include // Sleep +#elif defined(_COMPATIBILITY_2) +#include "Compatibility2Includes.h" +#else +#include // usleep +#endif + +void RakSleep(unsigned int ms) +{ +#ifdef _WIN32 + Sleep(ms); +#else + usleep(ms * 1000); +#endif +} diff --git a/raknet/RakSleep.h b/raknet/RakSleep.h new file mode 100644 index 0000000..8bbfc37 --- /dev/null +++ b/raknet/RakSleep.h @@ -0,0 +1,6 @@ +#ifndef __RAK_SLEEP_H +#define __RAK_SLEEP_H + +void RakSleep(unsigned int ms); + +#endif