Skip to content

Commit

Permalink
Merge pull request #96 from BurningEnlightenment/dev/fix-dynamic-thre…
Browse files Browse the repository at this point in the history
…ad-pool-impl-selection

Simplify the selection for the dynamic thread pool implementation
  • Loading branch information
ned14 authored Aug 18, 2022
2 parents 48ea96b + a83851b commit 7986b92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
24 changes: 6 additions & 18 deletions include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7986b92

Please sign in to comment.