3#include "../Logging/Logger.h"
12void Cogs::Threads::setName(Thread& thread,
const std::string& name) {
13 if(thread.get_id() == std::this_thread::get_id()) {
14 pthread_setname_np(name.c_str());
17 LOG_ERROR(logger,
"Attempting to set the name (%s) of thread %d from outside the thread.", name.c_str(), pthread_threadid_np(thread.native_handle(),
nullptr));
21void Cogs::Threads::sleep(
int milliseconds) {
22 std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
25void Cogs::Threads::yield() {
26 std::this_thread::yield();
29size_t Cogs::Threads::hardwareConcurrency() {
30 return std::thread::hardware_concurrency();
Log implementation class.
constexpr Log getLogger(const char(&name)[LEN]) noexcept