2 #ifndef BOOST_CONTRACT_DETAIL_CHECKING_HPP_
3 #define BOOST_CONTRACT_DETAIL_CHECKING_HPP_
5 // Copyright (C) 2008-2018 Lorenzo Caminiti
6 // Distributed under the Boost Software License, Version 1.0 (see accompanying
7 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
8 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
10 #include <boost/contract/core/config.hpp>
11 #include <boost/contract/detail/static_local_var.hpp>
12 #include <boost/contract/detail/declspec.hpp>
13 #include <boost/thread/mutex.hpp>
14 #include <boost/noncopyable.hpp>
15 #include <boost/config.hpp>
17 namespace boost { namespace contract { namespace detail {
21 #pragma warning(disable: 4275) // Base w/o DLL spec (noncopyable).
22 #pragma warning(disable: 4251) // Member w/o DLL spec (mutex_ type).
25 // RAII facility to disable assertions while checking other assertions.
26 class BOOST_CONTRACT_DETAIL_DECLSPEC checking :
27 private boost::noncopyable // Non-copyable resource (might use mutex, etc.).
31 #ifndef BOOST_CONTRACT_DISABLE_THREADS
39 #ifndef BOOST_CONTRACT_DISABLE_THREADS
46 static bool already() {
47 #ifndef BOOST_CONTRACT_DISABLE_THREADS
48 return already_locked();
50 return already_unlocked();
61 static bool already_unlocked();
62 static bool already_locked();
65 typedef static_local_var<mutex_tag, boost::mutex> mutex;
68 typedef static_local_var_init<checking_tag, bool, bool, false> flag;
77 #ifdef BOOST_CONTRACT_HEADER_ONLY
78 #include <boost/contract/detail/inlined/detail/checking.hpp>
81 #endif // #include guard