| 639 | } |
| 640 | |
| 641 | void generic_scheduler::local_spawn_root_and_wait( task& first, task*& next ) { |
| 642 | __TBB_ASSERT( governor::is_set(this), NULL ); |
| 643 | __TBB_ASSERT( &first, NULL ); |
| 644 | auto_empty_task dummy( __TBB_CONTEXT_ARG(this, first.prefix().context) ); |
| 645 | internal::reference_count n = 0; |
| 646 | for( task* t=&first; ; t=t->prefix().next ) { |
| 647 | ++n; |
| 648 | __TBB_ASSERT( !t->prefix().parent, "not a root task, or already running" ); |
| 649 | t->prefix().parent = &dummy; |
| 650 | if( &t->prefix().next==&next ) break; |
| 651 | #if __TBB_TASK_GROUP_CONTEXT |
| 652 | __TBB_ASSERT( t->prefix().context == t->prefix().next->prefix().context, |
| 653 | "all the root tasks in list must share the same context"); |
| 654 | #endif /* __TBB_TASK_GROUP_CONTEXT */ |
| 655 | } |
| 656 | dummy.prefix().ref_count = n+1; |
| 657 | if( n>1 ) |
| 658 | local_spawn( *first.prefix().next, next ); |
| 659 | local_wait_for_all( dummy, &first ); |
| 660 | } |
| 661 | |
| 662 | void tbb::internal::generic_scheduler::spawn( task& first, task*& next ) { |
| 663 | governor::local_scheduler()->local_spawn( first, next ); |
no test coverage detected