X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f6d4ca5d06bb0d90e4d5505d8b289e2a1c8a39d1..e16ebb1333db2cee332bbfed4098df88777cec22:/teshsuite/s4u/listen_async/listen_async.cpp diff --git a/teshsuite/s4u/listen_async/listen_async.cpp b/teshsuite/s4u/listen_async/listen_async.cpp index 9cae4a2e17..c4ad656ee7 100644 --- a/teshsuite/s4u/listen_async/listen_async.cpp +++ b/teshsuite/s4u/listen_async/listen_async.cpp @@ -17,7 +17,7 @@ static void server() { simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox"); - simgrid::s4u::this_actor::isend(mailbox, xbt_strdup("Some data"), 0); + simgrid::s4u::CommPtr sendComm = simgrid::s4u::this_actor::isend(mailbox, xbt_strdup("Some data"), 0); xbt_assert(mailbox->listen()); // True (1) XBT_INFO("Task listen works on regular mailboxes"); @@ -26,11 +26,12 @@ static void server() xbt_assert(not strcmp("Some data", res), "Data received: %s", res); XBT_INFO("Data successfully received from regular mailbox"); xbt_free(res); + sendComm->wait(); simgrid::s4u::MailboxPtr mailbox2 = simgrid::s4u::Mailbox::byName("mailbox2"); mailbox2->setReceiver(simgrid::s4u::Actor::self()); - simgrid::s4u::this_actor::isend(mailbox2, xbt_strdup("More data"), 0); + simgrid::s4u::this_actor::isend(mailbox2, xbt_strdup("More data"), 0)->detach(); xbt_assert(mailbox2->listen()); // used to break. XBT_INFO("Task listen works on asynchronous mailboxes"); @@ -50,5 +51,7 @@ int main(int argc, char* argv[]) simgrid::s4u::Actor::createActor("test", simgrid::s4u::Host::by_name("Tremblay"), server); e->run(); + + delete e; return 0; }