Fixed memory leaks in threaded URCU (general_threaded, signal_threaded)
[libcds.git] / cds / urcu / options.h
1 //$$CDS-header$$
2
3 #ifndef CDSLIB_URCU_OPTIONS_H
4 #define CDSLIB_URCU_OPTIONS_H
5
6 #include <cds/details/defs.h>
7
8 namespace cds { namespace urcu {
9     /// Exception "RCU deadlock detected"
10     /**@anchor cds_urcu_rcu_deadlock
11         This exception is raised when \p cds::opt::v::rcu_throw_deadlock deadlock checking policy
12         is used, see \p cds::opt::rcu_check_deadlock option.
13     */
14     class rcu_deadlock: public std::logic_error
15     {
16         //@cond
17     public:
18         rcu_deadlock()
19             : std::logic_error( "RCU deadlock detected" )
20         {}
21         //@endcond
22     };
23 }} // namespace cds::urcu
24
25
26 namespace cds { namespace opt {
27
28     /// [type-option] RCU check deadlock option setter
29     /**
30         The RCU containers can check if a deadlock between read-side critical section
31         and \p synchronize call is possible.
32         This option specifies a policy for checking this situation.
33         Possible \p Type is:
34         - \p opt::v::rcu_no_check_deadlock - no deadlock checking
35         - \p opt::v::rcu_assert_deadlock - call \p assert in debug mode only
36         - \p opt::v::rcu_throw_deadlock - throw an \p cds::urcu::rcu_deadlock exception when a deadlock
37             is encountered
38
39         Usually, the default \p Type for this option is \p opt::v::rcu_throw_deadlock.
40     */
41     template <typename Type>
42     struct rcu_check_deadlock
43     {
44         //@cond
45         template <typename Base> struct pack: public Base
46         {
47             typedef Type rcu_check_deadlock;
48         };
49         //@endcond
50     };
51
52     namespace v {
53         /// \ref opt::rcu_check_deadlock option value: no deadlock checking
54         struct rcu_no_check_deadlock {};
55
56         /// \ref opt::rcu_check_deadlock option value: call \p assert in debug mode only
57         struct rcu_assert_deadlock {};
58
59         /// \ref opt::rcu_check_deadlock option value: throw a cds::urcu::rcu_deadlock exception when a deadlock detected
60         struct rcu_throw_deadlock {};
61     }
62 }}  // namespace cds::opt
63
64
65 #endif  // #ifndef CDSLIB_URCU_OPTIONS_H