X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5ed37babb2fa9097abe82df299c0aa259ed84d5a..c6683b41cf9ecda70c1d4d75d1effc61903a894f:/teshsuite/mc/mutex-handling/mutex-handling.cpp diff --git a/teshsuite/mc/mutex-handling/mutex-handling.cpp b/teshsuite/mc/mutex-handling/mutex-handling.cpp index 22224b656d..8f986360a2 100644 --- a/teshsuite/mc/mutex-handling/mutex-handling.cpp +++ b/teshsuite/mc/mutex-handling/mutex-handling.cpp @@ -24,11 +24,13 @@ #include "simgrid/s4u/Mailbox.hpp" #include "simgrid/s4u/Mutex.hpp" +#include // std::unique_lock + XBT_LOG_NEW_DEFAULT_CATEGORY(mutex_handling, "Messages specific for this test"); static int receiver(const char* box_name) { - auto mb = simgrid::s4u::Mailbox::by_name(box_name); + auto* mb = simgrid::s4u::Mailbox::by_name(box_name); std::unique_ptr payload; payload = mb->get_unique(); @@ -43,16 +45,13 @@ static int receiver(const char* box_name) static int sender(const char* box_name, simgrid::s4u::MutexPtr mutex, int value) { auto* payload = new int(value); - auto mb = simgrid::s4u::Mailbox::by_name(box_name); + auto* mb = simgrid::s4u::Mailbox::by_name(box_name); + std::unique_lock lock; if (mutex) - mutex->lock(); + lock = std::unique_lock(*mutex); mb->put(payload, 8); - - if (mutex) - mutex->unlock(); - return 0; }