loolwsd/Util.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
New commits: commit f137a96d5c55d9f12e73b8d880f5d5b3986d3691 Author: Ashod Nakashian <ashod.nakash...@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 <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@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. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits