Files
salmanoff/smocore/componentThread.cpp
T
hayodea 1c397dfeb5 Split: Split libspinscale off from SMO.
Now we can probably begin using libspinscale in Couresilient
without worrying about excessive technical debt later on.
2026-02-22 17:46:27 -04:00

34 lines
782 B
C++

#include <stdexcept>
#include <string>
#include <iostream>
#include <pthread.h>
#include <componentThread.h>
namespace sscl {
std::string ComponentThread::getThreadName(sscl::ThreadId id)
{
// Cast ThreadId to SmoThreadId for validation and lookup
smo::SmoThreadId smoId = static_cast<smo::SmoThreadId>(id);
if (static_cast<int>(smoId) >= static_cast<int>(smo::SmoThreadId::N_ITEMS))
{
throw std::runtime_error(std::string(__func__)
+ ": Invalid thread ID");
}
// Use function-local static to ensure proper initialization order
static const std::string threadNames[static_cast<int>(smo::SmoThreadId::N_ITEMS)]
= {
"mrntt",
"director",
"simulator",
"subconscious",
"body",
"world"
};
return threadNames[static_cast<int>(smoId)];
}
} // namespace sscl