Skip to content

Commit

Permalink
limit parallelism for resource mounting to 4
Browse files Browse the repository at this point in the history
  • Loading branch information
technetium-cfx authored and blattersturm committed Apr 16, 2017
1 parent f974292 commit dd1766d
Showing 1 changed file with 16 additions and 1 deletion.
Expand Up @@ -19,12 +19,27 @@

#include <network/uri.hpp>

#include <ppl.h>

#include <Error.h>

using fx::CachedResourceMounter;

void MountResourceCacheDevice(std::shared_ptr<ResourceCache> cache);

static auto g_limitedScheduler = concurrency::Scheduler::Create(
concurrency::SchedulerPolicy(2,
concurrency::MinConcurrency, 1,
concurrency::MaxConcurrency, 4));

static struct : public concurrency::scheduler_interface
{
virtual void schedule(concurrency::TaskProc_t proc, void* arg) override
{
g_limitedScheduler->ScheduleTask(proc, arg);
}
} g_schedulerWrap;

CachedResourceMounter::CachedResourceMounter(fx::ResourceManager* manager)
: m_manager(manager)
{
Expand Down Expand Up @@ -149,7 +164,7 @@ concurrency::task<fwRefContainer<fx::Resource>> CachedResourceMounter::LoadResou
}

return localResource;
});
}, concurrency::task_options(g_schedulerWrap));
}
}

Expand Down

0 comments on commit dd1766d

Please sign in to comment.