summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/WorldStorage.cpp21
-rw-r--r--src/WorldStorage/WorldStorage.h3
2 files changed, 9 insertions, 15 deletions
diff --git a/src/WorldStorage/WorldStorage.cpp b/src/WorldStorage/WorldStorage.cpp
index c3bfbd4f6..9ad995c82 100644
--- a/src/WorldStorage/WorldStorage.cpp
+++ b/src/WorldStorage/WorldStorage.cpp
@@ -13,7 +13,6 @@
#include "../Generating/ChunkGenerator.h"
#include "../Entities/Entity.h"
#include "../BlockEntities/BlockEntity.h"
-#include "../OSSupport/Promise.h"
@@ -100,7 +99,7 @@ void cWorldStorage::WaitForFinish(void)
}
// Wait for the saving to finish:
- WaitForQueuesEmpty();
+ WaitForSaveQueueEmpty();
// Wait for the thread to finish:
m_ShouldTerminate = true;
@@ -114,21 +113,15 @@ void cWorldStorage::WaitForFinish(void)
-void cWorldStorage::WaitForQueuesEmpty(void)
+void cWorldStorage::WaitForLoadQueueEmpty(void)
{
-
- cPromise * LoadPromise = m_LoadQueue.BlockTillEmpty();
- cPromise * SavePromise = m_SaveQueue.BlockTillEmpty();
- cPromise * QueuePromise = LoadPromise->WaitFor(SavePromise);
- cPromise * CancelPromise = QueuePromise->CancelOn(m_ShouldTerminate);
- CancelPromise->Wait();
- delete CancelPromise;
- delete QueuePromise;
- delete SavePromise;
- delete LoadPromise;
+ m_LoadQueue.BlockTillEmpty();
}
-
+void cWorldStorage::WaitForSaveQueueEmpty(void)
+{
+ m_SaveQueue.BlockTillEmpty();
+}
diff --git a/src/WorldStorage/WorldStorage.h b/src/WorldStorage/WorldStorage.h
index c3eb96ce8..98eb5fce7 100644
--- a/src/WorldStorage/WorldStorage.h
+++ b/src/WorldStorage/WorldStorage.h
@@ -79,7 +79,8 @@ public:
bool Start(cWorld * a_World, const AString & a_StorageSchemaName); // Hide the cIsThread's Start() method, we need to provide args
void Stop(void); // Hide the cIsThread's Stop() method, we need to signal the event
void WaitForFinish(void);
- void WaitForQueuesEmpty(void);
+ void WaitForLoadQueueEmpty(void);
+ void WaitForSaveQueueEmpty(void);
size_t GetLoadQueueLength(void);
size_t GetSaveQueueLength(void);