X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8e3525c475262f259a70a3f9a2a4f12d36b3d243..a0d47b6eaf07218a602ed6606da925fbd3629909:/src/xbt/OsSemaphore.hpp diff --git a/src/xbt/OsSemaphore.hpp b/src/xbt/OsSemaphore.hpp index b29a66550d..821075f6b0 100644 --- a/src/xbt/OsSemaphore.hpp +++ b/src/xbt/OsSemaphore.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2019-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -8,8 +8,7 @@ #include #include -namespace simgrid { -namespace xbt { +namespace simgrid::xbt { class XBT_PUBLIC OsSemaphore { public: explicit inline OsSemaphore(unsigned int capa) : capa_(capa) {} @@ -23,7 +22,7 @@ public: inline void release() { - std::unique_lock lock(mutex_); + const std::scoped_lock lock(mutex_); ++capa_; condition_.notify_one(); } @@ -33,5 +32,4 @@ private: std::mutex mutex_; std::condition_variable condition_; }; -} // namespace xbt -} // namespace simgrid +} // namespace simgrid::xbt