1
0
mirror of synced 2024-09-24 11:38:26 +02:00

fix: Properly clear thread-local thread name

This commit is contained in:
WerWolv 2024-01-09 21:46:54 +01:00
parent b408baf254
commit f518bdadbd

View File

@ -29,6 +29,8 @@ namespace hex {
std::condition_variable s_jobCondVar;
std::vector<std::jthread> s_workers;
thread_local std::string s_currentThreadName;
}
@ -56,6 +58,7 @@ namespace hex {
Task::~Task() {
if (!this->isFinished())
this->interrupt();
s_currentThreadName.clear();
}
void Task::update(u64 value) {
@ -277,6 +280,8 @@ namespace hex {
s_deferredCalls.clear();
s_tasksFinishedCallbacks.clear();
s_currentThreadName.clear();
}
TaskHolder TaskManager::createTask(std::string name, u64 maxValue, bool background, std::function<void(Task&)> function) {
@ -365,7 +370,6 @@ namespace hex {
s_tasksFinishedCallbacks.push_back(function);
}
thread_local static std::string s_currentThreadName;
void TaskManager::setCurrentThreadName(const std::string &name) {
s_currentThreadName = name;
#if defined(OS_WINDOWS)