28 using std::this_thread::yield;
29 using std::this_thread::sleep_for;
30 using std::chrono_literals::operator
""us;
38 const uint NUM_THREADS = 200;
39 const uint MAX_RAND_SUMMAND = 100;
44 template<
class POLICY>
49 size_t control_sum_{0};
59 and control_sum_ == hot_sum_;
65 uint val =
rani (MAX_RAND_SUMMAND);
77 hot_sum_ += 2 * (a+b);
106 CHECK (can_calc_without_Error<NonrecursiveLock_NoWait>());
107 CHECK (can_calc_without_Error<RecursiveLock_NoWait>());
108 CHECK (not can_calc_without_Error<sync::NoLocking>());
112 template<
class POLICY>
114 can_calc_without_Error()
116 Checker<POLICY> checksum;
119 for (uint i=1; i<=NUM_THREADS; ++i)
120 threads.emplace ([&checksum,
121 a = checksum.createVal(),
122 b = checksum.createVal()]
124 checksum.addValues (a,b);
127 while (
explore(threads).has_any())
130 return checksum.verify();
Facility for monitor object based locking.
A fixed collection of non-copyable polymorphic objects.
Helper to verify a contended chain calculation.
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
int rani(uint bound=_iBOUND())
Implementation namespace for support and library code.
Managing a collection of non-copyable polymorphic objects in compact storage.
Object Monitor based synchronisation.
Abstract Base Class for all testcases.
Simplistic test class runner.
Convenience front-end to simplify and codify basic thread handling.
Building tree expanding and backtracking evaluations within hierarchical scopes.
void addValues(uint a, uint b)