14#include <boost/test/unit_test.hpp>
18BOOST_AUTO_TEST_SUITE(util_threadnames_tests)
29 std::vector<std::thread> threads;
30 std::set<std::string> names;
33 auto RenameThisThread = [&](
int i) {
35 std::lock_guard<std::mutex> guard(lock);
39 threads.reserve(num_threads);
40 for (
int i = 0; i < num_threads; ++i) {
41 threads.emplace_back(RenameThisThread, i);
44 for (std::thread& thread : threads) thread.join();
60 for (
int i = 0; i < 100; ++i) {
BOOST_AUTO_TEST_SUITE_END()
void ThreadRename(const std::string &)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.
std::string ThreadGetInternalName()
Get the thread's internal (in-memory) name; used e.g.
std::string ToString(const T &t)
Locale-independent version of std::to_string.
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
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