It runs correctly now, but I'm not sure of its results.
In particular, it seems to find a counter-example correclty, contrarily of what
is written in leading comments.
auto mb = simgrid::s4u::Mailbox::by_name(box_name);
payload = static_cast<int*>(mb->get());
auto mb = simgrid::s4u::Mailbox::by_name(box_name);
payload = static_cast<int*>(mb->get());
- MC_assert(*payload == 0);
- free(payload);
+ MC_assert(*payload == 1);
+ delete payload;
payload = static_cast<int*>(mb->get());
payload = static_cast<int*>(mb->get());
- MC_assert(*payload == 1);
- free(payload);
+ MC_assert(*payload == 2);
+ delete payload;
int* payload = new int(value);
auto mb = simgrid::s4u::Mailbox::by_name(box_name);
int* payload = new int(value);
auto mb = simgrid::s4u::Mailbox::by_name(box_name);
-#ifndef DISABLE_THE_MUTEX
- mutex->lock();
-#endif
+ if (mutex)
+ mutex->lock();
mb->put(static_cast<void*>(payload), 8);
mb->put(static_cast<void*>(payload), 8);
-#ifndef DISABLE_THE_MUTEX
- mutex->unlock();
-#endif
+ if (mutex)
+ mutex->unlock();
+
return 0;
}
int main(int argc, char* argv[])
{
return 0;
}
int main(int argc, char* argv[])
{
- XBT_ATTRIB_UNUSED simgrid::s4u::MutexPtr mutex;
-#ifndef DISABLE_THE_MUTEX
- mutex = simgrid::s4u::Mutex::create();
-#endif
-
simgrid::s4u::Engine e(&argc, argv);
simgrid::s4u::Engine e(&argc, argv);
- xbt_assert(argc > 2,
- "Usage: %s platform_file deployment_file\n"
- "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ xbt_assert(argc > 1, "Usage: %s platform_file\n"
+ "\tExample: %s msg_platform.xml\n",
- e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Tremblay"), sender, "box", mutex, 1);
- simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Tremblay"), sender, "box", mutex, 2);
- simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name("Jupiter"), receiver, "box");
-
+ simgrid::s4u::MutexPtr mutex;
#ifndef DISABLE_THE_MUTEX
mutex = simgrid::s4u::Mutex::create();
#endif
#ifndef DISABLE_THE_MUTEX
mutex = simgrid::s4u::Mutex::create();
#endif
+ e.load_platform(argv[1]);
+ simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name("Jupiter"), receiver, "box");
+ simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Boivin"), sender, "box", mutex, 1);
+ simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Fafard"), sender, "box", mutex, 2);
+
e.run();
XBT_INFO("Simulation time %g", e.get_clock());
e.run();
XBT_INFO("Simulation time %g", e.get_clock());
#!/usr/bin/env tesh
! expect return 1
#!/usr/bin/env tesh
! expect return 1
$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/mutex-handling ${srcdir:=.}/examples/platforms/small_platform.xml ${srcdir:=.}/teshsuite/mc/mutex-handling/mutex-handling_d.xml
$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/mutex-handling ${srcdir:=.}/examples/platforms/small_platform.xml ${srcdir:=.}/teshsuite/mc/mutex-handling/mutex-handling_d.xml
#!/usr/bin/env tesh
! expect return 1
#!/usr/bin/env tesh
! expect return 1
! timeout 30
$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/without-mutex-handling ${srcdir:=.}/examples/platforms/small_platform.xml ${srcdir:=.}/teshsuite/mc/mutex-handling/mutex-handling_d.xml
! timeout 30
$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/without-mutex-handling ${srcdir:=.}/examples/platforms/small_platform.xml ${srcdir:=.}/teshsuite/mc/mutex-handling/mutex-handling_d.xml