diff --git a/src/tbb/arena.cpp b/src/tbb/arena.cpp index 7e5bf44cbb..1f187a4589 100644 --- a/src/tbb/arena.cpp +++ b/src/tbb/arena.cpp @@ -291,7 +291,7 @@ arena::arena(threading_control* control, unsigned num_slots, unsigned num_reserv arena& arena::allocate_arena(threading_control* control, unsigned num_slots, unsigned num_reserved_slots, unsigned priority_level #if __TBB_PREVIEW_PARALLEL_PHASE - , tbb::task_arena::leave_policy wl + , tbb::task_arena::leave_policy lp #endif ) { @@ -359,7 +359,7 @@ bool arena::has_enqueued_tasks() { void arena::request_workers(int mandatory_delta, int workers_delta, bool wakeup_threads) { #if __TBB_PREVIEW_PARALLEL_PHASE - my_thread_leave.restore_state_if_needed(); + my_thread_leave.restore_default_policy_if_needed(); #endif my_threading_control->adjust_demand(my_tc_client, mandatory_delta, workers_delta); diff --git a/src/tbb/arena.h b/src/tbb/arena.h index 6d52b27d09..2cf81dcaf2 100644 --- a/src/tbb/arena.h +++ b/src/tbb/arena.h @@ -220,7 +220,7 @@ class thread_leave_manager { do { if (prev & PARALLEL_PHASE_MASK) { // The parallel phase is already started, thus simply add a reference to it - desired = PARALLEL_PHASE + prev; + desired = prev + PARALLEL_PHASE; } else if (prev == ONE_TIME_FAST_LEAVE) { // State was previously transitioned to "One-time Fast leave", thus // with the start of new parallel phase, it should be then transitioned to "Delayed leave" diff --git a/src/tbb/waiters.h b/src/tbb/waiters.h index 84f4c30ab5..a217933b7d 100644 --- a/src/tbb/waiters.h +++ b/src/tbb/waiters.h @@ -102,7 +102,7 @@ class outermost_worker_waiter : public waiter_base { using base_type = waiter_base; bool is_delayed_leave_enabled() { - #if __TBB_PREVIEW_PARALLEL_PHASE +#if __TBB_PREVIEW_PARALLEL_PHASE return my_arena.my_thread_leave.is_retention_allowed(); #else return !governor::hybrid_cpu(); diff --git a/test/tbb/test_task_arena.cpp b/test/tbb/test_task_arena.cpp index 78f1a1bd68..7033ffbe94 100644 --- a/test/tbb/test_task_arena.cpp +++ b/test/tbb/test_task_arena.cpp @@ -2095,7 +2095,8 @@ std::size_t measure_median_start_time(tbb::task_arena* ta, const F1& start = F1{ auto get_longest_start = [&] (std::chrono::steady_clock::time_point start_time) { std::size_t longest_time = 0; for (auto& time : start_times) { - longest_time = std::max(longest_time, (std::size_t)std::chrono::duration_cast(time - start_time).count()); + auto diff = std::chrono::duration_cast(time - start_time); + longest_time = std::max(longest_time, std::size_t(diff.count())); } return longest_time; }; @@ -2162,7 +2163,7 @@ class start_time_collection_phase_wrapped std::size_t measure_impl() { arena->start_parallel_phase(); auto median_start_time = measure_median_start_time(arena); - arena->end_parallel_phase(true); + arena->end_parallel_phase(/*with_fast_leave*/true); return median_start_time; }; };