diff options
Diffstat (limited to 'libcxx/include/__threading_support')
-rw-r--r-- | libcxx/include/__threading_support | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support index 4d867167c2b1..2242a6908529 100644 --- a/libcxx/include/__threading_support +++ b/libcxx/include/__threading_support @@ -29,16 +29,9 @@ # include <__external_threading> #elif !defined(_LIBCPP_HAS_NO_THREADS) -#if defined(__APPLE__) || defined(__MVS__) -# define _LIBCPP_NO_NATIVE_SEMAPHORES -#endif - #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) # include <pthread.h> # include <sched.h> -# ifndef _LIBCPP_NO_NATIVE_SEMAPHORES -# include <semaphore.h> -# endif #elif defined(_LIBCPP_HAS_THREAD_API_C11) # include <threads.h> #endif @@ -78,12 +71,6 @@ typedef pthread_mutex_t __libcpp_recursive_mutex_t; typedef pthread_cond_t __libcpp_condvar_t; #define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER -#ifndef _LIBCPP_NO_NATIVE_SEMAPHORES -// Semaphore -typedef sem_t __libcpp_semaphore_t; -# define _LIBCPP_SEMAPHORE_MAX SEM_VALUE_MAX -#endif - // Execute once typedef pthread_once_t __libcpp_exec_once_flag; #define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT @@ -149,12 +136,6 @@ typedef void* __libcpp_recursive_mutex_t[5]; typedef void* __libcpp_condvar_t; #define _LIBCPP_CONDVAR_INITIALIZER 0 -// Semaphore -typedef void* __libcpp_semaphore_t; -#if defined(_LIBCPP_HAS_THREAD_API_WIN32) -# define _LIBCPP_SEMAPHORE_MAX (::std::numeric_limits<long>::max()) -#endif - // Execute Once typedef void* __libcpp_exec_once_flag; #define _LIBCPP_EXEC_ONCE_INITIALIZER 0 @@ -219,26 +200,6 @@ int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv); -#ifndef _LIBCPP_NO_NATIVE_SEMAPHORES - -// Semaphore -_LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_semaphore_init(__libcpp_semaphore_t* __sem, int __init); - -_LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_semaphore_destroy(__libcpp_semaphore_t* __sem); - -_LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_semaphore_post(__libcpp_semaphore_t* __sem); - -_LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_semaphore_wait(__libcpp_semaphore_t* __sem); - -_LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_semaphore_wait_timed(__libcpp_semaphore_t* __sem, chrono::nanoseconds const& __ns); - -#endif // _LIBCPP_NO_NATIVE_SEMAPHORES - // Execute once _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_execute_once(__libcpp_exec_once_flag *flag, @@ -452,38 +413,6 @@ int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv) return pthread_cond_destroy(__cv); } -#ifndef _LIBCPP_NO_NATIVE_SEMAPHORES - -// Semaphore -bool __libcpp_semaphore_init(__libcpp_semaphore_t* __sem, int __init) -{ - return sem_init(__sem, 0, __init) == 0; -} - -bool __libcpp_semaphore_destroy(__libcpp_semaphore_t* __sem) -{ - return sem_destroy(__sem) == 0; -} - -bool __libcpp_semaphore_post(__libcpp_semaphore_t* __sem) -{ - return sem_post(__sem) == 0; -} - -bool __libcpp_semaphore_wait(__libcpp_semaphore_t* __sem) -{ - return sem_wait(__sem) == 0; -} - -bool __libcpp_semaphore_wait_timed(__libcpp_semaphore_t* __sem, chrono::nanoseconds const& __ns) -{ - auto const __abs_time = chrono::system_clock::now().time_since_epoch() + __ns; - __libcpp_timespec_t __ts = __thread_detail::__convert_to_timespec(__abs_time); - return sem_timedwait(__sem, &__ts) == 0; -} - -#endif //_LIBCPP_NO_NATIVE_SEMAPHORES - // Execute once int __libcpp_execute_once(__libcpp_exec_once_flag *flag, void (*init_routine)()) { |