From fd73109f03c80c76b2fbc5e7f0bdcb5f0a3b3103 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 9 Dec 2016 22:30:25 +0000 Subject: [PATCH] this is broken but proves where our race condition comes from --- .../server/library/serverDatabase/src/shared/Persister.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/server/library/serverDatabase/src/shared/Persister.cpp b/engine/server/library/serverDatabase/src/shared/Persister.cpp index 4539325c..48bf3b94 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.cpp +++ b/engine/server/library/serverDatabase/src/shared/Persister.cpp @@ -346,18 +346,23 @@ void Persister::startSave(void) m_currentSnapshots.begin()->second->takeTimestamp(); // queue up snapshots to be saved + m_savingDeleting_mtx.lock(); + ServerSnapshotMap::iterator i; for (i=m_currentSnapshots.begin(); i!=m_currentSnapshots.end(); ++i) { m_savingSnapshots.push_back(i->second); taskQueue->asyncRequest(new TaskSaveSnapshot(i->second)); } + for (i=m_newObjectSnapshots.begin(); i!=m_newObjectSnapshots.end(); ++i) { m_savingSnapshots.push_back(i->second); taskQueue->asyncRequest(new TaskSaveSnapshot(i->second)); } + m_savingDeleting_mtx.unlock(); + // nothing changed so send a complete message for the shutdown process if( m_savingSnapshots.empty() ) {