X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/149c63f36e15b8500b1e826bda5138318ff7ba2b..86a1011750f50a04258aa9cf0eeb23e666cf6bf2:/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 8002e01f47..fd6effa37d 100644 --- a/teshsuite/s4u/listen_async/listen_async.cpp +++ b/teshsuite/s4u/listen_async/listen_async.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2021. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -21,11 +21,13 @@ static void server() xbt_assert(mailbox->listen()); // True (1) XBT_INFO("Task listen works on regular mailboxes"); - const std::string* res = static_cast(mailbox->get()); + XBT_INFO("Mailbox::listen_from() returns %ld (should return my pid, which is %ld)", mailbox->listen_from(), + simgrid::s4u::this_actor::get_pid()); + + auto res = mailbox->get_unique(); xbt_assert(*res == "Some data", "Data received: %s", res->c_str()); XBT_INFO("Data successfully received from regular mailbox"); - delete res; sendComm->wait(); simgrid::s4u::Mailbox* mailbox2 = simgrid::s4u::Mailbox::by_name("mailbox2"); @@ -36,9 +38,8 @@ static void server() xbt_assert(mailbox2->listen()); // used to break. XBT_INFO("Task listen works on asynchronous mailboxes"); - res = static_cast(mailbox2->get()); + res = mailbox2->get_unique(); xbt_assert(*res == "More data"); - delete res; XBT_INFO("Data successfully received from asynchronous mailbox"); } @@ -48,7 +49,7 @@ int main(int argc, char* argv[]) simgrid::s4u::Engine e(&argc, argv); e.load_platform(argv[1]); - simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("Tremblay"), server); + simgrid::s4u::Actor::create("test", e.host_by_name("Tremblay"), server); e.run();