24 template <
typename RefCount>
26 constexpr
size_t numIters = 100000;
27 constexpr
size_t numThreads = 10;
35 std::vector<std::thread> ts;
37 for (
size_t t = 0;
t < numThreads; ++
t) {
38 ts.emplace_back([&count, &b, &got0,
t, &threadBatons] {
39 for (
size_t i = 0;
i < numIters; ++
i) {
44 threadBatons[
t].
post();
52 for (
size_t i = 0;
i < numIters; ++
i) {
63 for (
size_t t = 0;
t < numThreads; ++
t) {
64 threadBatons[
t].
wait();
84 template <
typename RefCount>
86 for (
size_t i = 0;
i < itersCount; ++
i) {
91 std::thread t1([&]() {
94 std::lock_guard<std::mutex> lg(mutex);
101 std::thread t2([&]() {
104 std::lock_guard<std::mutex> lg(mutex);
117 basicTest<TLRefCount>();
123 stressTest<TLRefCount>(500);
#define EXPECT_EQ(val1, val2)
—— Concurrent Priority Queue Implementation ——
FOLLY_ALWAYS_INLINE void wait(const WaitOptions &opt=wait_options()) noexcept
void stressTest(size_t itersCount)
#define EXPECT_TRUE(condition)
TEST(SequencedExecutor, CPUThreadPoolExecutor)