1 /* Copyright (c) 2013-2020. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 /******************** Non-deterministic message ordering *********************/
7 /* This example implements one process which receives messages from two other */
8 /* processes. There is no bug on it, it is just provided to test the soundness*/
9 /* of the state space reduction with DPOR, if the maximum depth (defined with */
10 /* --cfg=model-check/max-depth:) is reached. */
11 /******************************************************************************/
13 #include <simgrid/modelchecker.h>
14 #include <simgrid/s4u.hpp>
18 XBT_LOG_NEW_DEFAULT_CATEGORY(electric_fence, "Example to check the soundness of DPOR");
22 void* data1 = nullptr;
23 void* data2 = nullptr;
24 simgrid::s4u::CommPtr comm_received1 = simgrid::s4u::Mailbox::by_name("mymailbox")->get_async(&data1);
25 simgrid::s4u::CommPtr comm_received2 = simgrid::s4u::Mailbox::by_name("mymailbox")->get_async(&data2);
27 comm_received1->wait();
28 comm_received2->wait();
31 delete static_cast<int*>(data1);
32 delete static_cast<int*>(data2);
35 static void client(int id)
37 int* payload = new int();
39 simgrid::s4u::Mailbox::by_name("mymailbox")->put(payload, 10000);
43 int main(int argc, char* argv[])
45 simgrid::s4u::Engine e(&argc, argv);
47 e.load_platform("platform.xml");
49 simgrid::s4u::Actor::create("server", simgrid::s4u::Host::by_name("HostA"), server);
50 simgrid::s4u::Actor::create("client", simgrid::s4u::Host::by_name("HostB"), client, 1);
51 simgrid::s4u::Actor::create("client", simgrid::s4u::Host::by_name("HostC"), client, 2);