1 /* Copyright (c) 2013-2023. 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 actor which receives messages from two other */
8 /* actors. 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");
18 namespace sg4 = simgrid::s4u;
24 sg4::CommPtr comm_received1 = sg4::Mailbox::by_name("mymailbox")->get_async<int>(&data1);
25 sg4::CommPtr comm_received2 = sg4::Mailbox::by_name("mymailbox")->get_async<int>(&data2);
27 comm_received1->wait();
28 comm_received2->wait();
35 static void client(int id)
37 auto* payload = new int(id);
38 sg4::Mailbox::by_name("mymailbox")->put(payload, 10000);
42 int main(int argc, char* argv[])
44 sg4::Engine e(&argc, argv);
46 e.load_platform(argv[1]);
48 sg4::Actor::create("server", e.host_by_name("HostA"), server);
49 sg4::Actor::create("client", e.host_by_name("HostB"), client, 1);
50 sg4::Actor::create("client", e.host_by_name("HostC"), client, 2);