, task_group_contexts. :
#include "tbb/task.h"
:
int main()
{
tbb::task_group_context tgc1;
tbb::task_group_context tgc2;
graph g1(tgc1);
graph g2(tgc2);
printf("Constructing graph\n");
broadcast_node< continue_msg > start(g1);
continue_node<continue_msg> a( g1, body("A"));
continue_node<continue_msg> b( g2, body("B"));
continue_node<continue_msg> c( g2, body("C"));
continue_node<continue_msg> d( g2, body("D"));
continue_node<continue_msg> e( g1, body("E"));
make_edge( start, a );
make_edge( start, b );
make_edge( a, c );
make_edge( b, c );
make_edge( c, d );
make_edge( a, e );
for (int i = 0; i < 3; ++i ) {
try
{
printf("broadcasting graph %d\n", i);
start.try_put( continue_msg() );
g1.wait_for_all();
g2.wait_for_all();
} catch (...)
{ printf("Caught exception\n");
}
g1.wait_for_all();
g1.reset();
g2.reset();
}
return 0;
}
task_group_context ( ). g2 g1. , , catch , . , , A E.

, . reset() reset continue_nodes '. , , , , g1 catch(...), g1.wait_for_all() try/catch. , .
B a multifunction_node continue_msg continue_msg:
typedef multifunction_node<continue_msg, tuple<continue_msg> > mf_type;
struct mf_body {
std::string my_name;
mf_body(const char *name) : my_name(name) {}
void operator()(continue_msg, mf_type::output_ports_type &op) {
if(my_name == "B") {
printf("%s returning without sending\n", my_name.c_str());
return;
}
sleep(1);
get<0>(op).try_put(continue_msg());
return;
}
};
node B:
mf_type b( g, unlimited, mf_body("B"));
B C :
make_edge( output_port<0>(b), c );
. node B , continue_msg . node B , node C , continue_msgs . reset , reset C count.
multifunction_node , . , a multifunction_node continue_msg continue_node. continue_node continue_msgs, ( .) multifunction_node , continue_msg, , . multifunction_nodes.