25 #ifndef __TERVEL_UTIL_UTIL_H_
26 #define __TERVEL_UTIL_UTIL_H_
40 #ifdef TERVEL_MEM_NO_FREE
41 #define TERVEL_MEM_HP_NO_FREE
42 #define TERVEL_MEM_RC_NO_FREE
44 #ifdef TERVEL_MEM_NO_WATCH
45 #define TERVEL_MEM_HP_NO_WATCH
46 #define TERVEL_MEM_RC_NO_WATCH
58 #ifdef TERVEL_MEM_HP_NO_WATCH
59 #ifndef TERVEL_MEM_HP_NO_FREE
60 #define TERVEL_MEM_HP_NO_FREE
76 #ifndef TERVEL_MEM_RC_MAX_NODES
77 #define TERVEL_MEM_RC_MAX_NODES 25
79 #ifndef TERVEL_MEM_RC_MIN_NODES
80 #define TERVEL_MEM_RC_MIN_NODES 5
89 #ifndef TERVEL_PROG_ASSUR_DELAY
90 #define TERVEL_PROG_ASSUR_DELAY 100
96 #ifdef TERVEL_PROG_ASSUR_NO_CHECK
97 #ifdef TERVEL_PROG_ASSUR_DELAY
98 #undef TERVEL_PROG_ASSUR_DELAY
100 #define TERVEL_PROG_ASSUR_DELAY -1
101 #define TERVEL_PROG_NO_ANNOUNCE
107 #ifdef TERVEL_PROG_ASSUR_ALWAYS_CHECK
108 #ifdef TERVEL_PROG_ASSUR_DELAY
109 #undef TERVEL_PROG_ASSUR_DELAY
111 #define TERVEL_PROG_ASSUR_DELAY 0
114 #ifdef TERVEL_PROG_ASSUR_NO_CHECK
115 #error TERVEL_PROG_ASSUR_NO_CHECK and TERVEL_PROG_ASSUR_ALWAYS_CHECK can not both be set.
120 #ifndef TERVEL_PROG_ASSUR_LIMIT
121 #define TERVEL_PROG_ASSUR_LIMIT 1000
128 #ifdef TERVEL_PROG_ASSUR_NO_ANNOUNCE
129 #ifdef TERVEL_PROG_ASSUR_LIMIT
130 #undef TERVEL_PROG_ASSUR_LIMIT
132 #define TERVEL_PROG_ASSUR_LIMIT -1
138 #ifdef TERVEL_PROG_ASSUR_ALWAYS_ANNOUNCE
139 #ifdef TERVEL_PROG_ASSUR_LIMIT
140 #undef TERVEL_PROG_ASSUR_LIMIT
142 #define TERVEL_PROG_ASSUR_LIMIT 0
156 uintptr_t temp =
reinterpret_cast<uintptr_t
>(value);
161 #ifndef TERVEL_DEF_BACKOFF_TIME_NS
162 #define TERVEL_DEF_BACKOFF_TIME_NS 10000
173 std::this_thread::sleep_for(std::chrono::nanoseconds(duration));
187 double val = std::log2(value);
188 int int_val =
static_cast<int>(val);
205 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
206 TypeName(const TypeName&) = delete; \
207 void operator=(const TypeName&) = delete
209 #endif // __TERVEL_UTIL_UTIL_H_
bool isValid(void *value)
Returns whether or not the passed value is has one of the reserved bits set to 1. ...
Definition: util.h:155
TODO(steven):
Definition: mcas.h:36
#define TERVEL_DEF_BACKOFF_TIME_NS
Definition: util.h:162
int round_to_next_power_of_two(uint64_t value)
Returns the next power of two.
Definition: wf_hash_map_no_delete.h:44
void backoff(int duration=TERVEL_DEF_BACKOFF_TIME_NS)
Sets the amount of time in nano-seconds for a thread to backoff before re-retrying.
Definition: util.h:172