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();
}
+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<double>(&res);
+ sg4::this_actor::sleep_for(33.1);
+ comm->wait();
+ delete res;
+}
+
int main(int argc, char** argv)
{
sg4::Engine e(&argc, 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();