/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* Bug report: https://github.com/simgrid/simgrid/issues/40
*
* Task.listen used to be on async mailboxes as it always returned false.
/* Bug report: https://github.com/simgrid/simgrid/issues/40
*
* Task.listen used to be on async mailboxes as it always returned false.
simgrid::s4u::CommPtr sendComm = mailbox->put_async(new std::string("Some data"), 0);
xbt_assert(mailbox->listen()); // True (1)
XBT_INFO("Task listen works on regular mailboxes");
simgrid::s4u::CommPtr sendComm = mailbox->put_async(new std::string("Some data"), 0);
xbt_assert(mailbox->listen()); // True (1)
XBT_INFO("Task listen works on regular mailboxes");
xbt_assert(*res == "Some data", "Data received: %s", res->c_str());
XBT_INFO("Data successfully received from regular mailbox");
delete res;
sendComm->wait();
xbt_assert(*res == "Some data", "Data received: %s", res->c_str());
XBT_INFO("Data successfully received from regular mailbox");
delete res;
sendComm->wait();
mailbox2->set_receiver(simgrid::s4u::Actor::self());
mailbox2->put_init(new std::string("More data"), 0)->detach();
mailbox2->set_receiver(simgrid::s4u::Actor::self());
mailbox2->put_init(new std::string("More data"), 0)->detach();