X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/74c678b8644aa28d345490294709922d4c489bf5..f6f99dcf9389833131b373cad4646479c4de8751:/examples/cpp/task-storm/s4u-task-storm.cpp diff --git a/examples/cpp/task-storm/s4u-task-storm.cpp b/examples/cpp/task-storm/s4u-task-storm.cpp index bfd52b740e..5c7ae70c68 100644 --- a/examples/cpp/task-storm/s4u-task-storm.cpp +++ b/examples/cpp/task-storm/s4u-task-storm.cpp @@ -74,7 +74,7 @@ int main(int argc, char* argv[]) Alternatively we: remove/add the link between SA and SA_to_B2 add/remove the link between SA and SA_to_B1 */ - SA->on_this_start_cb([&](sg4::Task* t) { + SA->on_this_start_cb([SA_to_B1,SA_to_B2](sg4::Task* t) { int count = t->get_count(); sg4::CommTaskPtr comm; if (count % 2 == 0) { @@ -95,31 +95,27 @@ int main(int argc, char* argv[]) }); // The token sent by SA is forwarded by both communication tasks - SA_to_B1->on_this_start_cb([&](sg4::Task* t) { - t->set_token(t->get_next_token_from(SA)); - }); - SA_to_B2->on_this_start_cb([&](sg4::Task* t) { - t->set_token(t->get_next_token_from(SA)); - }); + SA_to_B1->on_this_start_cb([&SA](sg4::Task* t) { t->set_token(t->get_next_token_from(SA)); }); + SA_to_B2->on_this_start_cb([&SA](sg4::Task* t) { t->set_token(t->get_next_token_from(SA)); }); /* B1 and B2 read the value of the token received by their predecessors and use it to adapt their amount of work to do. */ - B1->on_this_start_cb([&](sg4::Task* t) { + B1->on_this_start_cb([SA_to_B1](sg4::Task* t) { auto data = t->get_next_token_from(SA_to_B1)->get_unique_data(); t->set_amount(*data * 10); }); - B2->on_this_start_cb([&](sg4::Task* t) { + B2->on_this_start_cb([SA_to_B2](sg4::Task* t) { auto data = t->get_next_token_from(SA_to_B2)->get_unique_data(); t->set_amount(*data * 10); }); - // Enqueue executions for tasks without predecessors - SA->enqueue_execs(5); - SB->enqueue_execs(5); + // Enqueue firings for tasks without predecessors + SA->enqueue_firings(5); + SB->enqueue_firings(5); // Add a function to be called when tasks end for log purpose - sg4::Task::on_end_cb([] + sg4::Task::on_completion_cb([] (const sg4::Task* t) { XBT_INFO("Task %s finished (%d)", t->get_name().c_str(), t->get_count()); });