ThreadManager: Make TaskType a property of a Task.

This commit is contained in:
Unknown W. Brackets committed 2021-12-05 21:01:49 -08:00
1 parent f9bab64bdf
commit 8b5173350f
6 files changed
+30 -12

No files matched your search

+5 -1
View File
@@ -785,6 +785,10 @@ public:
ReplacedTextureTask(ReplacedTexture &tex, LimitedWaitable *w) : tex_(tex), waitable_(w) {
}
TaskType Type() const override {
return TaskType::IO_BLOCKING;
}
void Run() override {
tex_.Prepare();
waitable_->Notify();
@@ -815,7 +819,7 @@ bool ReplacedTexture::IsReady(double budget) {
if (g_Config.bReplaceTexturesAllowLate) {
threadWaitable_ = new LimitedWaitable();
g_threadManager.EnqueueTask(new ReplacedTextureTask(*this, threadWaitable_), TaskType::IO_BLOCKING);
g_threadManager.EnqueueTask(new ReplacedTextureTask(*this, threadWaitable_));
if (threadWaitable_->WaitFor(budget)) {
threadWaitable_->WaitAndRelease();