From 2a5ce960474d5aafa1787b9c7d780f833bc4be4e Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 2 Mar 2021 12:44:53 +0100 Subject: [PATCH] REVIEWED: Wait() to support FreeBSD #1618 --- src/core.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core.c b/src/core.c index 8ac725e25..409621380 100644 --- a/src/core.c +++ b/src/core.c @@ -202,15 +202,16 @@ unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod); unsigned int __stdcall timeEndPeriod(unsigned int uPeriod); #endif - - #elif defined(__linux__) + #endif + #if defined(__linux__) || defined(__FreeBSD__) #include // Required for: timespec, nanosleep(), select() - POSIX //#define GLFW_EXPOSE_NATIVE_X11 // WARNING: Exposing Xlib.h > X.h results in dup symbols for Font type //#define GLFW_EXPOSE_NATIVE_WAYLAND //#define GLFW_EXPOSE_NATIVE_MIR #include "GLFW/glfw3native.h" // Required for: glfwGetX11Window() - #elif defined(__APPLE__) + #endif + #if defined(__APPLE__) #include // Required for: usleep() //#define GLFW_EXPOSE_NATIVE_COCOA // WARNING: Fails due to type redefinition @@ -4234,7 +4235,8 @@ static void Wait(float ms) #if defined(_WIN32) Sleep((unsigned int)ms); - #elif defined(__linux__) || defined(PLATFORM_WEB) + #endif + #if defined(__linux__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) struct timespec req = { 0 }; time_t sec = (int)(ms/1000.0f); ms -= (sec*1000); @@ -4243,7 +4245,8 @@ static void Wait(float ms) // NOTE: Use nanosleep() on Unix platforms... usleep() it's deprecated. while (nanosleep(&req, &req) == -1) continue; - #elif defined(__APPLE__) + #endif + #if defined(__APPLE__) usleep(ms*1000.0f); #endif