Add sem_timedwait polyfill for macOS.

This commit is contained in:
squidbus 2024-07-28 16:31:15 -07:00
parent aa795f5c59
commit 43d60a8ac9
2 changed files with 36 additions and 7 deletions

View file

@ -85,12 +85,16 @@ if (APPLE)
find_package(date 3.0.1 CONFIG)
endif()
# Note: Windows always has these functions through winpthreads
include(CheckSymbolExists)
check_symbol_exists(pthread_mutex_timedlock "pthread.h" HAVE_PTHREAD_MUTEX_TIMEDLOCK)
# Windows always has the function through winpthreads
if(HAVE_PTHREAD_MUTEX_TIMEDLOCK OR WIN32)
add_compile_options(-DHAVE_PTHREAD_MUTEX_TIMEDLOCK)
endif()
check_symbol_exists(sem_timedwait "semaphore.h" HAVE_SEM_TIMEDWAIT)
if(HAVE_SEM_TIMEDWAIT OR WIN32)
add_compile_options(-DHAVE_SEM_TIMEDWAIT)
endif()
add_subdirectory(externals)
include_directories(src)