1 /* Copyright (c) 2013-2021. 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>
16 XBT_LOG_NEW_DEFAULT_CATEGORY(electric_fence, "Example to check the soundness of DPOR");
22 simgrid::s4u::CommPtr comm_received1 = simgrid::s4u::Mailbox::by_name("mymailbox")->get_async<int>(&data1);
23 simgrid::s4u::CommPtr comm_received2 = simgrid::s4u::Mailbox::by_name("mymailbox")->get_async<int>(&data2);
25 comm_received1->wait();
26 comm_received2->wait();
33 static void client(int id)
35 auto* payload = new int(id);
36 simgrid::s4u::Mailbox::by_name("mymailbox")->put(payload, 10000);
40 int main(int argc, char* argv[])
42 simgrid::s4u::Engine e(&argc, argv);
44 e.load_platform(argv[1]);
46 simgrid::s4u::Actor::create("server", simgrid::s4u::Host::by_name("HostA"), server);
47 simgrid::s4u::Actor::create("client", simgrid::s4u::Host::by_name("HostB"), client, 1);
48 simgrid::s4u::Actor::create("client", simgrid::s4u::Host::by_name("HostC"), client, 2);