Chris@16: // (C) Copyright 2012 Vicente J. Botet Escriba Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: Chris@16: #ifndef BOOST_THREAD_IS_LOCKED_BY_THIS_THREAD_HPP Chris@16: #define BOOST_THREAD_IS_LOCKED_BY_THIS_THREAD_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost Chris@16: { Chris@16: template Chris@16: class testable_mutex; Chris@16: Chris@16: /** Chris@16: * Overloaded function used to check if the mutex is locked when it is testable and do nothing otherwise. Chris@16: * Chris@16: * This function is used usually to assert the pre-condition when the function can only be called when the mutex Chris@16: * must be locked by the current thread. Chris@16: */ Chris@16: template Chris@16: bool is_locked_by_this_thread(testable_mutex const& mtx) Chris@16: { Chris@16: return mtx.is_locked_by_this_thread(); Chris@16: } Chris@16: template Chris@16: bool is_locked_by_this_thread(Lockable const&) Chris@16: { Chris@16: return true; Chris@16: } Chris@16: } Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // header