mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add 'system.max-bg-asset-loaders' setting
This commit is contained in:
parent
1cf4fb8703
commit
63024133be
8 changed files with 26 additions and 9 deletions
|
|
@ -371,12 +371,13 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<Task> AssetsLoader::startTask(runnable onDone) {
|
||||
std::shared_ptr<Task> AssetsLoader::startTask(runnable onDone, int maxWorkers) {
|
||||
auto pool =
|
||||
std::make_shared<util::ThreadPool<aloader_entry, assetload::postfunc>>(
|
||||
"assets-loader-pool",
|
||||
[=]() { return std::make_shared<LoaderWorker>(this); },
|
||||
[this](const assetload::postfunc& func) { func(&assets); }
|
||||
[this](const assetload::postfunc& func) { func(&assets); },
|
||||
maxWorkers
|
||||
);
|
||||
pool->setOnComplete(std::move(onDone));
|
||||
pool->setJobsSource([this]() -> std::optional<aloader_entry> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue