mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 12:42:34 +01:00
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:
@@ -10,14 +10,7 @@
|
|||||||
#if BX_CRT_NONE
|
#if BX_CRT_NONE
|
||||||
# include <bx/cpu.h>
|
# include <bx/cpu.h>
|
||||||
# include <bx/crt0.h>
|
# include <bx/crt0.h>
|
||||||
#elif BX_PLATFORM_ANDROID \
|
#elif BX_PLATFORM_POSIX
|
||||||
|| BX_PLATFORM_LINUX \
|
|
||||||
|| BX_PLATFORM_IOS \
|
|
||||||
|| BX_PLATFORM_OSX \
|
|
||||||
|| BX_PLATFORM_PS4 \
|
|
||||||
|| BX_PLATFORM_RPI \
|
|
||||||
|| BX_PLATFORM_NX \
|
|
||||||
|| BX_PLATFORM_VISIONOS
|
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
#elif BX_PLATFORM_WINDOWS \
|
#elif BX_PLATFORM_WINDOWS \
|
||||||
|| BX_PLATFORM_WINRT \
|
|| BX_PLATFORM_WINRT \
|
||||||
|
|||||||
10
src/os.cpp
10
src/os.cpp
@@ -19,15 +19,7 @@
|
|||||||
# endif // WIN32_LEAN_AND_MEAN
|
# endif // WIN32_LEAN_AND_MEAN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <psapi.h>
|
# include <psapi.h>
|
||||||
#elif BX_PLATFORM_ANDROID \
|
#elif BX_PLATFORM_POSIX
|
||||||
|| BX_PLATFORM_EMSCRIPTEN \
|
|
||||||
|| BX_PLATFORM_IOS \
|
|
||||||
|| BX_PLATFORM_LINUX \
|
|
||||||
|| BX_PLATFORM_NX \
|
|
||||||
|| BX_PLATFORM_OSX \
|
|
||||||
|| BX_PLATFORM_PS4 \
|
|
||||||
|| BX_PLATFORM_RPI \
|
|
||||||
|| BX_PLATFORM_VISIONOS
|
|
||||||
# include <sched.h> // sched_yield
|
# include <sched.h> // sched_yield
|
||||||
# if BX_PLATFORM_IOS \
|
# if BX_PLATFORM_IOS \
|
||||||
|| BX_PLATFORM_OSX \
|
|| BX_PLATFORM_OSX \
|
||||||
|
|||||||
@@ -14,18 +14,8 @@
|
|||||||
|
|
||||||
#if BX_CRT_NONE
|
#if BX_CRT_NONE
|
||||||
# include <bx/crt0.h>
|
# include <bx/crt0.h>
|
||||||
#elif BX_PLATFORM_ANDROID \
|
#elif BX_PLATFORM_POSIX
|
||||||
|| BX_PLATFORM_LINUX \
|
|
||||||
|| BX_PLATFORM_IOS \
|
|
||||||
|| BX_PLATFORM_OSX \
|
|
||||||
|| BX_PLATFORM_PS4 \
|
|
||||||
|| BX_PLATFORM_RPI \
|
|
||||||
|| BX_PLATFORM_NX \
|
|
||||||
|| BX_PLATFORM_VISIONOS
|
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
# if BX_PLATFORM_LINUX && (BX_CRT_GLIBC < 21200)
|
|
||||||
# include <sys/prctl.h>
|
|
||||||
# endif // BX_PLATFORM_
|
|
||||||
#elif BX_PLATFORM_WINDOWS \
|
#elif BX_PLATFORM_WINDOWS \
|
||||||
|| BX_PLATFORM_WINRT \
|
|| BX_PLATFORM_WINRT \
|
||||||
|| BX_PLATFORM_XBOXONE \
|
|| BX_PLATFORM_XBOXONE \
|
||||||
@@ -243,7 +233,7 @@ namespace bx
|
|||||||
|| BX_PLATFORM_IOS \
|
|| BX_PLATFORM_IOS \
|
||||||
|| BX_PLATFORM_VISIONOS
|
|| BX_PLATFORM_VISIONOS
|
||||||
pthread_setname_np(_name);
|
pthread_setname_np(_name);
|
||||||
#elif (BX_CRT_GLIBC >= 21200)
|
#elif BX_CRT_GLIBC
|
||||||
pthread_setname_np(ti->m_handle, _name);
|
pthread_setname_np(ti->m_handle, _name);
|
||||||
#elif BX_PLATFORM_LINUX
|
#elif BX_PLATFORM_LINUX
|
||||||
prctl(PR_SET_NAME,_name, 0, 0, 0);
|
prctl(PR_SET_NAME,_name, 0, 0, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user