[Libreoffice-commits] online.git: loolwsd/Util.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Oct 6 05:54:05 UTC 2016


 loolwsd/Util.hpp |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit f137a96d5c55d9f12e73b8d880f5d5b3986d3691
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Oct 5 22:04:25 2016 -0400

    loolwsd: use less intrusive way of asserting lock ownership
    
    Change-Id: I180cfc4effdf67e83ea4c4ca9958806d87d3f193
    Reviewed-on: https://gerrit.libreoffice.org/29544
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp
index ffb269d..bd1a5a3 100644
--- a/loolwsd/Util.hpp
+++ b/loolwsd/Util.hpp
@@ -14,7 +14,7 @@
 #include <cassert>
 #include <functional>
 #include <memory>
-#include <regex>
+#include <mutex>
 #include <set>
 #include <sstream>
 #include <string>
@@ -90,9 +90,15 @@ namespace Util
 
     /// Assert that a lock is already taken.
     template <typename T>
-    void assertIsLocked(T& lock)
+    void assertIsLocked(const T& lock)
     {
-        assert(!lock.try_lock());
+        assert(lock.owns_lock());
+    }
+
+    inline
+    void assertIsLocked(std::mutex& mtx)
+    {
+        assert(!mtx.try_lock());
     }
 
     /// Safely remove a file or directory.


More information about the Libreoffice-commits mailing list