Tervel  1.0.0
A collection of wait-free containers and algorithms.
recursive_action.h
Go to the documentation of this file.
1 /*
2 The MIT License (MIT)
3 
4 Copyright (c) 2015 University of Central Florida's Computer Software Engineering
5 Scalable & Secure Systems (CSE - S3) Lab
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 */
25 #ifndef TERVEL_UTIL_RECURSIVE_ACTION_H
26 #define TERVEL_UTIL_RECURSIVE_ACTION_H
27 
28 #include <tervel/util/info.h>
29 #include <tervel/util/util.h>
30 
31 namespace tervel{
32 namespace util {
39  public:
42  tervel::tl_thread_info->get_num_threads() + 1) {
44  }
46  }
47 
50  }
51 
55  static bool recursive_return(bool change = false, bool value = false);
56 
57  static void set_recursive_return() {
58  recursive_return(true, true);
59  };
60 
61  static void clear_recursive_return() {
62  recursive_return(true, false);
63  };
64 
70  static size_t recursive_depth(size_t i = 0);
71 
72  private:
74 }; // class RecursiveAction
75 
76 } // namespace util
77 } // namespace tervel
78 #endif // TERVEL_UTIL_RECURSIVE_ACTION_H
RecursiveAction()
Definition: recursive_action.h:40
TODO(steven):
Definition: mcas.h:36
Helper class for RAII management of recursive helping of threads.
Definition: recursive_action.h:38
DISALLOW_COPY_AND_ASSIGN(RecursiveAction)
~RecursiveAction()
Definition: recursive_action.h:48
static bool recursive_return(bool change=false, bool value=false)
static size_t recursive_depth(size_t i=0)
Adds the passed value and returns the pre-incremented value.
__thread ThreadContext * tl_thread_info
static void set_recursive_return()
Definition: recursive_action.h:57
static void clear_recursive_return()
Definition: recursive_action.h:61