26 template <
typename CallOnceFunc>
27 void bm_impl(CallOnceFunc&& fn,
size_t iters) {
28 std::deque<std::thread>
threads;
30 threads.emplace_back([&fn, iters] {
31 for (
size_t j = 0u; j < iters; ++j) {
36 for (std::thread&
t : threads) {
41 TEST(FollyCallOnce, Simple) {
43 auto fn = [&](
int* outp) { ++*outp; };
51 struct ExpectedException {};
59 throw ExpectedException();
67 TEST(FollyCallOnce, Stress) {
68 for (
int i = 0;
i < 100; ++
i) {
#define EXPECT_THROW(statement, expected_exception)
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
static size_t const kNumThreads
std::vector< std::thread::id > threads
FOLLY_ALWAYS_INLINE void call_once(basic_once_flag< Mutex, Atom > &flag, F &&f, Args &&...args)
void bm_impl(CallOnceFunc &&fn, size_t iters)
TEST(FollyCallOnce, Simple)