mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +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> {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public:
|
|||
/// @throws assetload::error
|
||||
void loadNext();
|
||||
|
||||
std::shared_ptr<Task> startTask(runnable onDone);
|
||||
std::shared_ptr<Task> startTask(runnable onDone, int maxWorkers);
|
||||
|
||||
const ResPaths& getPaths() const;
|
||||
aloader_func getLoader(AssetType tag);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue