Fixes for different BSD variants

This commit is contained in:
SChernykh 2022-12-17 12:52:08 +01:00
parent da12b329be
commit 07a5b191bb
3 changed files with 8 additions and 3 deletions

View file

@ -184,6 +184,7 @@ include(CheckCXXSourceCompiles)
check_cxx_source_compiles("int main(){ return __builtin_clzll(1);}" HAVE_BUILTIN_CLZLL)
check_cxx_source_compiles("#include <intrin.h>\n#pragma intrinsic(_BitScanReverse64)\nint main(){unsigned long r;_BitScanReverse64(&r,1);return r;}" HAVE_BITSCANREVERSE64)
check_cxx_source_compiles("#include <sched.h>\nint main(){sched_param param;return sched_setscheduler(0, SCHED_IDLE, &param);}" HAVE_SCHED)
if (HAVE_BUILTIN_CLZLL)
add_definitions(/DHAVE_BUILTIN_CLZLL)
@ -193,6 +194,10 @@ if (HAVE_BITSCANREVERSE64)
add_definitions(/DHAVE_BITSCANREVERSE64)
endif()
if (HAVE_SCHED)
add_definitions(/DHAVE_SCHED)
endif()
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES})
if (STATIC_BINARY OR STATIC_LIBS)

@ -1 +1 @@
Subproject commit 118bb7b1b3efe5b1e3f811b0b122abdbb952fb87
Subproject commit 89031917e9780b3ea0439bf362446efe5b59244c

View file

@ -21,7 +21,7 @@
#include <map>
#include <thread>
#ifndef _WIN32
#if !defined(_WIN32) && defined(HAVE_SCHED)
#include <sched.h>
#endif
@ -66,7 +66,7 @@ void make_thread_background()
SetThreadPriorityBoost(GetCurrentThread(), true);
SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN);
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE);
#elif !defined(__APPLE__) && !defined(__FreeBSD__)
#elif defined(HAVE_SCHED)
sched_param param;
param.sched_priority = 0;
if (sched_setscheduler(0, SCHED_IDLE, &param) != 0) {