From 4b354ccdbe7365f0942641a6f61f7537d7bf9233 Mon Sep 17 00:00:00 2001 From: Tyler Karaszewski Date: Fri, 11 Sep 2020 09:08:13 -0700 Subject: [PATCH] Fix race condition --- sqlitecluster/SQLiteSequentialNotifier.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlitecluster/SQLiteSequentialNotifier.cpp b/sqlitecluster/SQLiteSequentialNotifier.cpp index d759d67ac..c0da09ed3 100644 --- a/sqlitecluster/SQLiteSequentialNotifier.cpp +++ b/sqlitecluster/SQLiteSequentialNotifier.cpp @@ -59,6 +59,7 @@ void SQLiteSequentialNotifier::cancel() { _globalResult = RESULT::CANCELED; for (auto& p : _valueToPendingThreadMap) { lock_guard lock(p.second->waitingThreadMutex); + p.second->result = RESULT::CANCELED; p.second->waitingThreadConditionVariable.notify_all(); } _valueToPendingThreadMap.clear(); @@ -70,6 +71,7 @@ void SQLiteSequentialNotifier::checkpointRequired(SQLite& db) { _globalResult = RESULT::CHECKPOINT_REQUIRED; for (auto& p : _valueToPendingThreadMap) { lock_guard lock(p.second->waitingThreadMutex); + p.second->result = RESULT::CHECKPOINT_REQUIRED; p.second->waitingThreadConditionVariable.notify_all(); } _valueToPendingThreadMap.clear();