X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/926f31504062e8af5960555834671fae6b02087a..83c4a771b7e8e4649b2a65877e93e8ba5eb7c887:/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp?ds=sidebyside diff --git a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp index 0c1db3c605..1261137a37 100644 --- a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp +++ b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2008-2019. 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. */ @@ -9,35 +9,34 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u test"); static void host() { - simgrid::s4u::Storage* storage = simgrid::s4u::Storage::byName("Disk1"); - int id = simgrid::s4u::this_actor::getPid(); + simgrid::s4u::Disk* disk = simgrid::s4u::this_actor::get_host()->get_disks().front(); // Disk1 + int id = simgrid::s4u::this_actor::get_pid(); XBT_INFO("process %d is writing!", id); - storage->write(3000000); + disk->write(4000000); XBT_INFO("process %d goes to sleep for %d seconds", id, id); simgrid::s4u::this_actor::sleep_for(id); XBT_INFO("process %d is writing again!", id); - storage->write(3000000); + disk->write(4000000); XBT_INFO("process %d goes to sleep for %d seconds", id, 6 - id); simgrid::s4u::this_actor::sleep_for(6 - id); XBT_INFO("process %d is reading!", id); - storage->read(3000000); + disk->read(4000000); XBT_INFO("process %d goes to sleep for %d seconds", id, id); simgrid::s4u::this_actor::sleep_for(id); XBT_INFO("process %d is reading again!", id); - storage->read(3000000); + disk->read(4000000); } int main(int argc, char** argv) { - simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv); - e->loadPlatform(argv[1]); + simgrid::s4u::Engine e(&argc, argv); + e.load_platform(argv[1]); for (int i = 0; i < 5; i++) - simgrid::s4u::Actor::createActor("host", simgrid::s4u::Host::by_name("bob"), host); + simgrid::s4u::Actor::create("host", simgrid::s4u::Host::by_name("bob"), host); - e->run(); - XBT_INFO("Simulation time %g", e->getClock()); + e.run(); + XBT_INFO("Simulation time %g", e.get_clock()); - delete e; return 0; }