understanding nested flowgraphs

understanding nested flowgraphs

Hi,

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:

http://www.threadingbuildingblocks.org/docs/help/tbb_userguide/use_neste...

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 ) {
    a.try_put(i);
}
g.wait_for_all();

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.

Antony

 

1 条帖子 / 0 全新
如需更全面地了解编译器优化,请参阅优化注意事项