understanding nested flowgraphs

understanding nested flowgraphs


I'd like to try implement nested flowgraphs in my application and as a first step attempted to copy/paste the code from the docs example here:


If I populate node 'a' with 3 items (exactly like the example) all is well and the program completes:

for ( int i = 0; i < 3; ++i ) {

However if I increment the loop by 1 such that node 'a' is populated with 4 or more messages, the program always deadlocks with some subset of node a's nested flowgraph tasks completing but no tasks from b's flowgraph ever being executed.

tbb::task_scheduler_init::default_num_threads() for my system returns 4. Alternatively if I initialize the task scheduler with only 3 threads I can then only put 2 items onto the top-level flow graph. In general it seems that waiting on a child flow graph doesn't cause the graph node to give up the thread while it waits. Is that correct or am I misunderstanding?  

thanks in advance.



1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.