Contents
Thread naming

Overview

The ThreadName namespace class provides a way to set a thread local string that is used by the logging system for the name of the current thread.

The implementation is very simple and only allows access to the thread name from the thread itself. ThreadName exists mainly to support logging, but may be used for other applications that do not need to access the names of other threads.

It is the responsibility of the end developer to ensure the same name is not used for multiple threads.

Quick start

#include <Balau/System/ThreadName.hpp>

The ThreadName namespace class provides two static methods, one for setting the current thread's name and another to get the current thread's name.

			// Set the current thread's name.
			ThreadName::setName("Main");

			// Get the current thread's name.
			const auto & name = ThreadName::getName();
		

Once a thread's namehas been set, the logging system's %thread format specifier will print the thread name instead of the native platform's thread id.