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

Method execute

benchmarks/tbb/pipeline.cpp:408–457  ·  view source on GitHub ↗

override*/

Source from the content-addressed store, hash-verified

406 bool do_segment_scanning;
407
408 /*override*/ task* execute() {
409 if( !my_pipeline.end_of_input )
410 if( !my_pipeline.filter_list->is_bound() )
411 if( my_pipeline.input_tokens > 0 ) {
412 recycle_as_continuation();
413 set_ref_count(1);
414 return new( allocate_child() ) stage_task( my_pipeline );
415 }
416 if( do_segment_scanning ) {
417 filter* current_filter = my_pipeline.filter_list->next_segment;
418 /* first non-thread-bound filter that follows thread-bound one
419 and may have valid items to process */
420 filter* first_suitable_filter = current_filter;
421 while( current_filter ) {
422 __TBB_ASSERT( !current_filter->is_bound(), "filter is thread-bound?" );
423 __TBB_ASSERT( current_filter->prev_filter_in_pipeline->is_bound(), "previous filter is not thread-bound?" );
424 if( !my_pipeline.end_of_input || current_filter->has_more_work())
425 {
426 task_info info;
427 info.reset();
428 if( current_filter->my_input_buffer->return_item(info, !current_filter->is_serial()) ) {
429 set_ref_count(1);
430 recycle_as_continuation();
431 return new( allocate_child() ) stage_task( my_pipeline, current_filter, info);
432 }
433 current_filter = current_filter->next_segment;
434 if( !current_filter ) {
435 if( !my_pipeline.end_of_input ) {
436 recycle_as_continuation();
437 return this;
438 }
439 current_filter = first_suitable_filter;
440 __TBB_Yield();
441 }
442 } else {
443 /* The preceding pipeline segment is empty.
444 Fast-forward to the next post-TBF segment. */
445 first_suitable_filter = first_suitable_filter->next_segment;
446 current_filter = first_suitable_filter;
447 }
448 } /* while( current_filter ) */
449 return NULL;
450 } else {
451 if( !my_pipeline.end_of_input ) {
452 recycle_as_continuation();
453 return this;
454 }
455 return NULL;
456 }
457 }
458public:
459 pipeline_root_task( pipeline& pipeline ): my_pipeline(pipeline), do_segment_scanning(false)
460 {

Callers

nothing calls this directly

Calls 5

is_boundMethod · 0.80
has_more_workMethod · 0.80
return_itemMethod · 0.80
is_serialMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected