static int master(int argc, char* argv[])
{
+ xbt_assert(argc == 5, "Expecting one parameter");
+
simgrid::s4u::MailboxPtr mailbox;
long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
double comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s");
static int worker(int argc, char* argv[])
{
+ xbt_assert(argc == 2, "Expecting one parameter");
long id = xbt_str_parse_int(argv[1], "Invalid argument %s");
simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(id));
double* payload = nullptr;
- double comp_size;
+ double comp_size = -1;
while (1) {
try {
payload = static_cast<double*>(mailbox->get());
try {
simgrid::s4u::this_actor::execute(comp_size);
} catch (xbt_ex& e) {
- switch (e.category) {
- case host_error:
- XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");
- return -1;
- default:
- xbt_die("Unexpected behavior");
- }
+ if (e.category == host_error) {
+ XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");
+ return -1;
+ } else
+ xbt_die("Unexpected behavior");
}
}
XBT_INFO("I'm done. See you!");