mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Only use pthread_attr_set_qos_class_np if it's available
Noticed in nixOS that DDNet package is marked as broken on Darwin for this reason: https://github.com/NixOS/nixpkgs/blob/master/pkgs/games/ddnet/default.nix
This commit is contained in:
parent
028ef41a52
commit
ccc6cd59de
|
@ -3,7 +3,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12)
|
|||
cmake_policy(VERSION ${CMAKE_VERSION})
|
||||
endif()
|
||||
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE INTERNAL "")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE INTERNAL "Minimum macOS deployment version")
|
||||
if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.13)
|
||||
message(WARNING "Building for macOS < 10.13 is not supported")
|
||||
endif()
|
||||
|
|
|
@ -53,6 +53,10 @@
|
|||
#include <Carbon/Carbon.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <mach/mach_time.h>
|
||||
|
||||
#if defined(__MAC_10_10) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10
|
||||
#include <pthread/qos.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif defined(CONF_FAMILY_WINDOWS)
|
||||
|
@ -742,7 +746,7 @@ void *thread_init(void (*threadfunc)(void *), void *u, const char *name)
|
|||
pthread_t id;
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
#if defined(CONF_PLATFORM_MACOS)
|
||||
#if defined(CONF_PLATFORM_MACOS) && defined(__MAC_10_10) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10
|
||||
pthread_attr_set_qos_class_np(&attr, QOS_CLASS_USER_INTERACTIVE, 0);
|
||||
#endif
|
||||
int result = pthread_create(&id, &attr, thread_run, data);
|
||||
|
|
Loading…
Reference in a new issue