X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/92c224ea97ba004a78199578a794111899cbd462..ea74f5d95928a521a588737e81f1de94eef25d19:/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 e277a3df8d..00e3182877 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-2022. 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. */ @@ -24,11 +24,10 @@ static void server() XBT_INFO("Mailbox::listen_from() returns %ld (should return my pid, which is %ld)", mailbox->listen_from(), simgrid::s4u::this_actor::get_pid()); - const std::string* res = static_cast(mailbox->get()); + 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"); @@ -39,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"); } @@ -51,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();