From 4fba47352e4a2cbfe0adaa5c2bbf3bd555a78e60 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Fri, 12 Sep 2025 09:49:08 +0200 Subject: [PATCH] Cleanup --- base/project.js | 3 +-- base/sources/backends/posix_thread.c | 4 ---- base/sources/backends/wasm_thread.c | 2 -- base/sources/backends/windows_thread.c | 4 ---- base/sources/iron.h | 8 +++++--- base/sources/iron_thread.h | 1 - 6 files changed, 6 insertions(+), 16 deletions(-) diff --git a/base/project.js b/base/project.js index 642c2136..05b9ee34 100644 --- a/base/project.js +++ b/base/project.js @@ -75,8 +75,7 @@ else if (platform == "linux") { add_thread_backend("posix"); add_gpu_backend("vulkan"); project.add_define("IRON_VULKAN"); - project.add_define("_POSIX_C_SOURCE=200112L"); - project.add_define("_XOPEN_SOURCE=600"); + project.add_define("_POSIX_C_SOURCE=200809L"); project.add_lib("dl"); project.add_lib("vulkan"); if (flags.with_audio) { diff --git a/base/sources/backends/posix_thread.c b/base/sources/backends/posix_thread.c index ac2baa1d..74bfa7ee 100644 --- a/base/sources/backends/posix_thread.c +++ b/base/sources/backends/posix_thread.c @@ -95,7 +95,3 @@ void iron_thread_set_name(const char *name) { pthread_setname_np(name); #endif } - -void iron_thread_sleep(int milliseconds) { - usleep(1000 * (useconds_t)milliseconds); -} diff --git a/base/sources/backends/wasm_thread.c b/base/sources/backends/wasm_thread.c index 5fcbb4fd..f1932553 100644 --- a/base/sources/backends/wasm_thread.c +++ b/base/sources/backends/wasm_thread.c @@ -12,8 +12,6 @@ void iron_threads_init() {} void iron_threads_quit() {} -void iron_thread_sleep(int milliseconds) {} - void iron_mutex_init(iron_mutex_t *mutex) {} void iron_mutex_destroy(iron_mutex_t *mutex) {} diff --git a/base/sources/backends/windows_thread.c b/base/sources/backends/windows_thread.c index b187bf9e..d94cc705 100644 --- a/base/sources/backends/windows_thread.c +++ b/base/sources/backends/windows_thread.c @@ -66,10 +66,6 @@ void iron_thread_set_name(const char *name) { } } -void iron_thread_sleep(int milliseconds) { - Sleep(milliseconds); -} - void iron_mutex_init(iron_mutex_t *mutex) { InitializeCriticalSection((LPCRITICAL_SECTION)&mutex->impl.criticalSection); } diff --git a/base/sources/iron.h b/base/sources/iron.h index a1e3fc8f..5dad6985 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -352,8 +352,7 @@ unsigned char *iron_deflate_raw(unsigned char *data, int data_len, int *out_len, #include "sinfl.h" #endif #if defined(IDLE_SLEEP) && !defined(IRON_WINDOWS) -// #include -int usleep(unsigned int usec); +#include #endif #ifdef IRON_MACOS @@ -397,7 +396,10 @@ void _update(void *data) { #ifdef IRON_WINDOWS Sleep(1); #else - usleep(1000); + struct timespec t; + t.tv_sec = 0; + t.tv_nsec = 1000000; + nanosleep(&t, NULL); #endif return; } diff --git a/base/sources/iron_thread.h b/base/sources/iron_thread.h index f832df4f..300e3b5c 100644 --- a/base/sources/iron_thread.h +++ b/base/sources/iron_thread.h @@ -14,7 +14,6 @@ void iron_thread_init(iron_thread_t *thread, void (*func)(void *param), void *pa void iron_thread_wait_and_destroy(iron_thread_t *thread); bool iron_thread_try_to_destroy(iron_thread_t *thread); void iron_thread_set_name(const char *name); -void iron_thread_sleep(int milliseconds); typedef struct iron_mutex { iron_mutex_impl_t impl;