diff options
Diffstat (limited to 'libgav1/src/utils/threadpool.h')
-rw-r--r-- | libgav1/src/utils/threadpool.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/libgav1/src/utils/threadpool.h b/libgav1/src/utils/threadpool.h index 79e7d12..fac875e 100644 --- a/libgav1/src/utils/threadpool.h +++ b/libgav1/src/utils/threadpool.h @@ -20,16 +20,27 @@ #include <functional> #include <memory> -#if defined(__ANDROID__) +#if defined(__APPLE__) +#include <TargetConditionals.h> +#endif + +#if !defined(LIBGAV1_THREADPOOL_USE_STD_MUTEX) +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) +#define LIBGAV1_THREADPOOL_USE_STD_MUTEX 1 +#else +#define LIBGAV1_THREADPOOL_USE_STD_MUTEX 0 +#endif +#endif + +#if LIBGAV1_THREADPOOL_USE_STD_MUTEX #include <condition_variable> // NOLINT (unapproved c++11 header) #include <mutex> // NOLINT (unapproved c++11 header) -#define LIBGAV1_THREADPOOL_USE_STD_MUTEX 1 #else // absl::Mutex & absl::CondVar are significantly faster than the pthread -// variants on platforms other than Android. -#include "third_party/absl/base/thread_annotations.h" -#include "third_party/absl/synchronization/mutex.h" -#define LIBGAV1_THREADPOOL_USE_STD_MUTEX 0 +// variants on platforms other than Android. iOS may deadlock on Shutdown() +// using absl, see b/142251739. +#include "absl/base/thread_annotations.h" +#include "absl/synchronization/mutex.h" #endif #include "src/utils/compiler_attributes.h" |