Small platform detection/usage improvements (#346)

* Use BX_PLATFORM_POSIX where needed

The semaphone implementation already uses BX_PLATFORM_POSIX to include
<pthread.h> on all the POSIX platforms; do the same also in other places
for consistency. This is done also for <sched.h>, which is a POSIX API,
and sched_yield() from it is already guarded by BX_PLATFORM_POSIX.

* Drop support for GNU libc older than 2.12

glibc 2.12 was released on 2010, and at this point any supported Linux
distro has that version or way greather than that.
This commit is contained in:
Pino Toscano
2025-06-07 18:01:25 +02:00
committed by GitHub
parent 5a20afef84
commit b59b7debd3
3 changed files with 4 additions and 29 deletions

View File

@@ -10,14 +10,7 @@
#if BX_CRT_NONE
# include <bx/cpu.h>
# include <bx/crt0.h>
#elif BX_PLATFORM_ANDROID \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_NX \
|| BX_PLATFORM_VISIONOS
#elif BX_PLATFORM_POSIX
# include <pthread.h>
#elif BX_PLATFORM_WINDOWS \
|| BX_PLATFORM_WINRT \

View File

@@ -19,15 +19,7 @@
# endif // WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <psapi.h>
#elif BX_PLATFORM_ANDROID \
|| BX_PLATFORM_EMSCRIPTEN \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_NX \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_VISIONOS
#elif BX_PLATFORM_POSIX
# include <sched.h> // sched_yield
# if BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX \

View File

@@ -14,18 +14,8 @@
#if BX_CRT_NONE
# include <bx/crt0.h>
#elif BX_PLATFORM_ANDROID \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_NX \
|| BX_PLATFORM_VISIONOS
#elif BX_PLATFORM_POSIX
# include <pthread.h>
# if BX_PLATFORM_LINUX && (BX_CRT_GLIBC < 21200)
# include <sys/prctl.h>
# endif // BX_PLATFORM_
#elif BX_PLATFORM_WINDOWS \
|| BX_PLATFORM_WINRT \
|| BX_PLATFORM_XBOXONE \
@@ -243,7 +233,7 @@ namespace bx
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_VISIONOS
pthread_setname_np(_name);
#elif (BX_CRT_GLIBC >= 21200)
#elif BX_CRT_GLIBC
pthread_setname_np(ti->m_handle, _name);
#elif BX_PLATFORM_LINUX
prctl(PR_SET_NAME,_name, 0, 0, 0);