X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d5b29830df70e823202e384a7655e4371193ecd7..7ac777931e588a2a48708ac16caeb50973f2cdf9:/teshsuite/s4u/comm-waitany/comm-waitany.cpp diff --git a/teshsuite/s4u/comm-waitany/comm-waitany.cpp b/teshsuite/s4u/comm-waitany/comm-waitany.cpp index 1dd41e13fa..6b9658317b 100644 --- a/teshsuite/s4u/comm-waitany/comm-waitany.cpp +++ b/teshsuite/s4u/comm-waitany/comm-waitany.cpp @@ -21,7 +21,7 @@ static void receiver() XBT_INFO("Placing %d asynchronous recv requests", NUM_COMMS); void* data; for (int i = 0; i < NUM_COMMS; i++) { - simgrid::s4u::CommPtr comm = simgrid::s4u::Comm::recv_async(mymailbox, &data); + simgrid::s4u::CommPtr comm = mymailbox->get_async(&data); pending_comms.push_back(comm); } @@ -29,16 +29,10 @@ static void receiver() XBT_INFO("Sleeping for 3 seconds (for the %dth time)...", i + 1); simgrid::s4u::this_actor::sleep_for(3.0); XBT_INFO("Calling wait_any() for %zu pending comms", pending_comms.size()); - std::vector::iterator ret_it = - simgrid::s4u::Comm::wait_any(pending_comms.begin(), pending_comms.end()); + int changed_pos = simgrid::s4u::Comm::wait_any(&pending_comms); XBT_INFO("Counting the number of completed comms..."); - int count = 0; - for (; ret_it != pending_comms.end(); count++, ret_it++) - ; - - XBT_INFO("wait_any() replied that %d comms have completed", count); - // xbt_assert(count == 1, "wait_any() replied that %d comms have completed, which is broken!", count); + pending_comms.erase(pending_comms.begin() + changed_pos); } } @@ -50,7 +44,7 @@ static void sender() for (int i = 0; i < NUM_COMMS; i++) { XBT_INFO("Sending a message to the receiver"); - simgrid::s4u::this_actor::send(theirmailbox, &data, 4); + theirmailbox->put(&data, 4); XBT_INFO("Sleeping for 1000 seconds"); simgrid::s4u::this_actor::sleep_for(1000.0); } @@ -69,7 +63,8 @@ int main(int argc, char** argv) simgrid::s4u::Actor::createActor("Sender", hosts[1], sender); xbt_free(hosts); - simgrid::s4u::Engine::instance()->run(); + engine->run(); + delete engine; return 0; }