3#ifdef TTK_ENABLE_OPENMP
7#if defined(__GNUC__) && !defined(__clang__)
8#include <parallel/algorithm>
11#ifdef TTK_ENABLE_OPENMP
20 ParallelGuard(
const int nThreads)
21 : oldThreadNumber_{omp_get_max_threads()} {
22 omp_set_num_threads(nThreads);
25 omp_set_num_threads(oldThreadNumber_);
39#if defined(_GLIBCXX_PARALLEL_FEATURES_H) && defined(TTK_ENABLE_OPENMP)
40#define TTK_PSORT(NTHREADS, ...) \
42 ttk::ParallelGuard pg{NTHREADS}; \
43 __gnu_parallel::sort(__VA_ARGS__); \
46#define TTK_PSORT(NTHREADS, ...) std::sort(__VA_ARGS__);
54#ifdef TTK_ENABLE_OPENMP
57 omp_init_lock(&this->lock_);
60 omp_destroy_lock(&this->lock_);
63 omp_set_lock(&this->lock_);
66 omp_unset_lock(&this->lock_);
70 Lock &operator=(
const Lock &) =
delete;
RAII wrapper around OpenMP lock.