37 using std::this_thread::yield;
38 using std::this_thread::sleep_for;
39 using std::chrono_literals::operator
""us;
47 const uint NUM_THREADS = 200;
48 const uint MAX_RAND_SUMMAND = 100;
53 template<
class POLICY>
58 size_t control_sum_{0};
68 and control_sum_ == hot_sum_;
74 uint val{rand() % MAX_RAND_SUMMAND};
86 hot_sum_ += 2 * (a+b);
114 CHECK (can_calc_without_Error<NonrecursiveLock_NoWait>());
115 CHECK (can_calc_without_Error<RecursiveLock_NoWait>());
116 CHECK (not can_calc_without_Error<sync::NoLocking>());
120 template<
class POLICY>
122 can_calc_without_Error()
124 Checker<POLICY> checksum;
127 for (uint i=1; i<=NUM_THREADS; ++i)
128 threads.emplace ([&checksum,
129 a = checksum.createVal(),
130 b = checksum.createVal()]
132 checksum.addValues (a,b);
135 while (
explore(threads).has_any())
138 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.
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.
Simple 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)