Skip to content

Commit

Permalink
Cleanup|FS: Waiting for file system operations
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Oct 29, 2018
1 parent b606355 commit 62ccd35
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doomsday/apps/server/src/remotefeeduser.cpp
Expand Up @@ -157,7 +157,7 @@ DENG2_PIMPL(RemoteFeedUser)
try
{
// Make sure the file system is ready for use.
Folder::waitForPopulation();
FS::get().waitForIdle();

std::unique_ptr<RemoteFeedMetadataPacket> response;

Expand Down
2 changes: 1 addition & 1 deletion doomsday/sdk/libcore/src/data/bank.cpp
Expand Up @@ -570,9 +570,9 @@ DENG2_PIMPL(Bank)
{
DENG2_ASSERT(serialCache);

FS::get().waitForIdle();
if (Folder *folder = serialCache->folder())
{
Folder::waitForPopulation(Folder::BlockingMainThread);
folder->destroyAllFilesRecursively();
}
}
Expand Down
11 changes: 9 additions & 2 deletions doomsday/sdk/libcore/src/filesys/folder.cpp
Expand Up @@ -541,8 +541,15 @@ void Folder::waitForPopulation(WaitBehavior waitBehavior)
DENG2_ASSERT(!App::inMainThread());
throw Error("Folder::waitForPopulation", "Not allowed to block the main thread");
}
LOG_MSG("Waiting until folders have been populated");
internal::populateTasks.waitForDone();
Time startedAt;
{
internal::populateTasks.waitForDone();
}
const auto elapsed = startedAt.since();
if (elapsed > .01)
{
LOG_MSG("Waited for %.3f seconds for file system to be ready") << elapsed;
}
}

AsyncTask *Folder::afterPopulation(std::function<void ()> func)
Expand Down

0 comments on commit 62ccd35

Please sign in to comment.