14 #if defined(HAVE_CONFIG_H)
18 #include <boost/test/unit_test.hpp>
31 std::vector<std::thread> threads;
32 std::set<std::string> names;
35 auto RenameThisThread = [&](
int i) {
37 std::lock_guard<std::mutex> guard(lock);
41 threads.reserve(num_threads);
42 for (
int i = 0; i < num_threads; ++i) {
43 threads.emplace_back(RenameThisThread, i);
46 for (std::thread& thread : threads) thread.join();
57 #if !defined(HAVE_THREAD_LOCAL)
67 for (
int i = 0; i < 100; ++i) {
BOOST_AUTO_TEST_SUITE(cuckoocache_tests)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
const std::string & ThreadGetInternalName()
Get the thread's internal (in-memory) name; used e.g.
void ThreadRename(std::string &&)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
std::string ToString(const T &t)
Locale-independent version of std::to_string.
BOOST_AUTO_TEST_CASE(util_threadnames_test_rename_threaded)
Rename a bunch of threads with the same basename (expect_multiple=true), ensuring suffixes are applie...
std::set< std::string > RenameEnMasse(int num_threads)
Run a bunch of threads to all call util::ThreadRename.
const std::string TEST_THREAD_NAME_BASE