diff options
author | Niall Douglas <s_github@nedprod.com> | 2022-08-18 17:10:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-18 17:10:05 +0300 |
commit | 7986b92283e2d92991fbbc77850faf6025932dc4 (patch) | |
tree | d4b533b854632a067dbe41c6415c99189094e0fa | |
parent | 48ea96b25766da66eb80d8a2769c5329f5bf8b86 (diff) | |
parent | a83851bd05393ce0150923fc20899cf1a6ca33a6 (diff) |
Merge pull request #96 from BurningEnlightenment/dev/fix-dynamic-thread-pool-impl-selection
Simplify the selection for the dynamic thread pool implementation
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp | 24 |
2 files changed, 7 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f7939e0..604416c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -353,10 +353,9 @@ else() check_have_libdispatch(WITH_LIBDISPATCH dispatch) if(LLFIO_HAS_LIBDISPATCH_WITH_LIBDISPATCH) all_link_libraries(PUBLIC dispatch) + all_compile_definitions(PUBLIC LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD=1) endif() endif() - else() - all_compile_definitions(PUBLIC LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD=0) endif() if(NOT LLFIO_HAS_LIBDISPATCH_BUILTIN AND NOT LLFIO_HAS_LIBDISPATCH_WITH_LIBDISPATCH AND (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)) indented_message(FATAL_ERROR "FATAL: Grand Central Dispatch as libdispatch was not found on this FreeBSD or Mac OS system. libdispatch is required for LLFIO to build on those systems.") diff --git a/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp b/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp index 240d5947..71a5096c 100644 --- a/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp +++ b/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp @@ -39,31 +39,19 @@ Distributed under the Boost Software License, Version 1.0. #include <iostream> -#ifndef LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD -#if LLFIO_FORCE_USE_LIBDISPATCH -#include <dispatch/dispatch.h> -#define LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD 1 -#else -#ifdef _WIN32 +#if defined(_WIN32) #include "windows/import.hpp" #include <threadpoolapiset.h> -#else -#if __has_include(<dispatch/dispatch.h>) -#include <dispatch/dispatch.h> -#define LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD 1 -#endif -#endif -#endif -#endif -#if !LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD && !defined(_WIN32) -#if !defined(__linux__) -#error dynamic_thread_pool_group requires Grand Central Dispatch (libdispatch) on non-Linux POSIX. -#endif +#elif defined(__linux__) && !LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD #include <dirent.h> /* Defines DT_* constants */ #include <sys/syscall.h> #include <condition_variable> #include <thread> +#elif __has_include(<dispatch/dispatch.h>) +#include <dispatch/dispatch.h> +#else +#error dynamic_thread_pool_group requires Grand Central Dispatch (libdispatch) on non-Linux POSIX. #endif #define LLFIO_DYNAMIC_THREAD_POOL_GROUP_PRINTING 0 |