Functions
assert_only_one_thread_test.cc File Reference
#include "cetlib/SimultaneousFunctionSpawner.h"
#include "cetlib/assert_only_one_thread.h"
#include <chrono>
#include <thread>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 27 of file assert_only_one_thread_test.cc.

28 {
30  auto will_fail = [] {
31  // Insert "by-hand" what the CET_ASSERT_ONLY_ONE_THREAD would
32  // expand to so that we can avoid an std::abort() for testing.
33  static cet::detail::ThreadCounter s{__FILE__, __LINE__, __func__};
35  std::this_thread::sleep_for(100ms);
36  };
37  SimultaneousFunctionSpawner launch{repeated_task(10u, will_fail)};
38 }
#define CET_ASSERT_ONLY_ONE_THREAD()
auto repeated_task(std::size_t const nInstances, F func)
static const double ms
Definition: Units.h:99
static QCString * s
Definition: config.cpp:1042