MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / set_priority

Method set_priority

benchmarks/tbb/task_group_context.cpp:476–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474
475#if __TBB_TASK_PRIORITY
476void task_group_context::set_priority ( priority_t prio ) {
477 __TBB_ASSERT( prio == priority_low || prio == priority_normal || prio == priority_high, "Invalid priority level value" );
478 intptr_t p = normalize_priority(prio);
479 if ( my_priority == p && !(my_state & task_group_context::may_have_children))
480 return;
481 my_priority = p;
482 internal::generic_scheduler* s = governor::local_scheduler_if_initialized();
483 if ( !s || !s->my_arena->propagate_task_group_state(&task_group_context::my_priority, *this, p) )
484 return;
485 // Updating arena priority here does not eliminate necessity of checking each
486 // task priority and updating arena priority if necessary before the task execution.
487 // These checks will be necessary because:
488 // a) set_priority() may be invoked before any tasks from this task group are spawned;
489 // b) all spawned tasks from this task group are retrieved from the task pools.
490 // These cases create a time window when arena priority may be lowered.
491 s->my_market->update_arena_priority( *s->my_arena, p );
492}
493
494priority_t task_group_context::priority () const {
495 return static_cast<priority_t>(priority_from_normalized_rep[my_priority]);

Callers 1

set_group_priorityMethod · 0.80

Calls 3

normalize_priorityFunction · 0.85
update_arena_priorityMethod · 0.80

Tested by

no test coverage detected