Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Factorize common code.
[simgrid.git] / src / xbt / OsSemaphore.hpp
index 6459850..6f3cf12 100644 (file)
@@ -1,8 +1,10 @@
-/* Copyright (c) 2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2019-2020. 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. */
 
+#include <xbt/base.h>
+
 #include <condition_variable>
 #include <mutex>
 
@@ -10,12 +12,12 @@ namespace simgrid {
 namespace xbt {
 class XBT_PUBLIC OsSemaphore {
 public:
-  inline OsSemaphore(unsigned int uiCount) : capa_(uiCount) {}
+  explicit inline OsSemaphore(unsigned int capa) : capa_(capa) {}
 
   inline void acquire()
   {
     std::unique_lock<std::mutex> lock(mutex_);
-    condition_.wait(lock, [&]() -> bool { return capa_ > 0; });
+    condition_.wait(lock, [this]() { return capa_ > 0; });
     --capa_;
   }