From c0cd56bc891505fdb174541b189034f878413a34 Mon Sep 17 00:00:00 2001 From: Fred Suter Date: Thu, 3 Nov 2022 17:29:23 -0400 Subject: [PATCH] complexify the test a bit further --- teshsuite/s4u/io-stream/io-stream.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/teshsuite/s4u/io-stream/io-stream.cpp b/teshsuite/s4u/io-stream/io-stream.cpp index d6b69af58a..9207fb94db 100644 --- a/teshsuite/s4u/io-stream/io-stream.cpp +++ b/teshsuite/s4u/io-stream/io-stream.cpp @@ -61,13 +61,11 @@ static void streamer(size_t size) XBT_INFO("Start two 10-second background traffic between Bob and Alice"); sg4::CommPtr bt1 = sg4::Comm::sendto_async(bob, alice, 2e7); - sg4::CommPtr bt2 = sg4::Comm::sendto_async(bob, alice, 2e7); XBT_INFO("[Bob -> Alice] Streaming (Transfer bottleneck)"); clock = sg4::Engine::get_clock(); sg4::Io::streamto(bob, bob_disk, alice, alice_disk, size); XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock() - clock); bt1->wait(); - bt2->wait(); XBT_INFO("[Bob -> Alice] Streaming \"from disk to memory\" (no write)"); clock = sg4::Engine::get_clock(); @@ -86,6 +84,19 @@ static void streamer(size_t size) } +static void background_send() { + sg4::this_actor::sleep_for(23.000150); + sg4::Mailbox::by_name("mbox")->put(new double(1), 2e7); +} + +static void background_recv() { + double* res; + sg4::CommPtr comm = sg4::Mailbox::by_name("mbox")->get_async(&res); + sg4::this_actor::sleep_for(33.1); + comm->wait(); + delete res; +} + int main(int argc, char** argv) { sg4::Engine e(&argc, argv); @@ -104,6 +115,8 @@ int main(int argc, char** argv) zone->seal(); sg4::Actor::create("streamer", bob, streamer, 4e6); + sg4::Actor::create("background send", bob, background_send); + sg4::Actor::create("background recv", alice, background_recv); e.run(); -- 2.20.1