1
0
mirror of synced 2024-09-25 12:08:26 +02:00

sys: Make sure deferred call adding is thread safe

This commit is contained in:
WerWolv 2022-03-15 23:46:02 +01:00
parent 050e17298a
commit 29ded2483c

View File

@ -172,15 +172,17 @@ namespace hex {
return { unlocalizedName, maxValue };
}
std::vector<std::function<void()>> s_deferredCalls;
void doLater(const std::function<void()> &function) {
static std::mutex tasksMutex;
std::scoped_lock lock(tasksMutex);
getDeferredCalls().push_back(function);
}
std::vector<std::function<void()>> &getDeferredCalls() {
return s_deferredCalls;
static std::vector<std::function<void()>> deferredCalls;
return deferredCalls;
}
}