Browse Source

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.
Pino Toscano 6 tháng trước cách đây
mục cha
commit
b59b7debd3
3 tập tin đã thay đổi với 4 bổ sung29 xóa
  1. 1 8
      src/mutex.cpp
  2. 1 9
      src/os.cpp
  3. 2 12
      src/thread.cpp

+ 1 - 8
src/mutex.cpp

@@ -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   \

+ 1 - 9
src/os.cpp

@@ -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       \

+ 2 - 12
src/thread.cpp

@@ -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);