[raknet] Implement RakSleep

This commit is contained in:
RD42 2023-11-01 21:16:31 +08:00
parent a89c9b75f9
commit a50b453784
2 changed files with 24 additions and 0 deletions

18
raknet/RakSleep.cpp Normal file
View File

@ -0,0 +1,18 @@
#if defined(_COMPATIBILITY_1)
#include "Compatibility1Includes.h"
#elif defined(_WIN32)
#include <windows.h> // Sleep
#elif defined(_COMPATIBILITY_2)
#include "Compatibility2Includes.h"
#else
#include <unistd.h> // usleep
#endif
void RakSleep(unsigned int ms)
{
#ifdef _WIN32
Sleep(ms);
#else
usleep(ms * 1000);
#endif
}

6
raknet/RakSleep.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef __RAK_SLEEP_H
#define __RAK_SLEEP_H
void RakSleep(unsigned int ms);
#endif