| 474 | |
| 475 | #if __TBB_TASK_PRIORITY |
| 476 | void 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 | |
| 494 | priority_t task_group_context::priority () const { |
| 495 | return static_cast<priority_t>(priority_from_normalized_rep[my_priority]); |
no test coverage detected