2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef CDSLIB_URCU_OPTIONS_H
32 #define CDSLIB_URCU_OPTIONS_H
34 #include <cds/details/defs.h>
36 namespace cds { namespace urcu {
37 /// Exception "RCU deadlock detected"
38 /**@anchor cds_urcu_rcu_deadlock
39 This exception is raised when \p cds::opt::v::rcu_throw_deadlock deadlock checking policy
40 is used, see \p cds::opt::rcu_check_deadlock option.
42 class rcu_deadlock: public std::logic_error
47 : std::logic_error( "RCU deadlock detected" )
51 }} // namespace cds::urcu
54 namespace cds { namespace opt {
56 /// [type-option] RCU check deadlock option setter
58 The RCU containers can check if a deadlock between read-side critical section
59 and \p synchronize call is possible.
60 This option specifies a policy for checking this situation.
62 - \p opt::v::rcu_no_check_deadlock - no deadlock checking
63 - \p opt::v::rcu_assert_deadlock - call \p assert in debug mode only
64 - \p opt::v::rcu_throw_deadlock - throw an \p cds::urcu::rcu_deadlock exception when a deadlock
67 Usually, the default \p Type for this option is \p opt::v::rcu_throw_deadlock.
69 template <typename Type>
70 struct rcu_check_deadlock
73 template <typename Base> struct pack: public Base
75 typedef Type rcu_check_deadlock;
81 /// \ref opt::rcu_check_deadlock option value: no deadlock checking
82 struct rcu_no_check_deadlock {};
84 /// \ref opt::rcu_check_deadlock option value: call \p assert in debug mode only
85 struct rcu_assert_deadlock {};
87 /// \ref opt::rcu_check_deadlock option value: throw a cds::urcu::rcu_deadlock exception when a deadlock detected
88 struct rcu_throw_deadlock {};
90 }} // namespace cds::opt
93 #endif // #ifndef CDSLIB_URCU_OPTIONS_H