summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-04-17 10:23:10 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2020-04-17 10:23:10 -0400
commit47867d427f46a8478aa0107738adab1bfbfc7c56 (patch)
tree174c4d40dcbfe1a3ce741ad045ec7d03c8d1174c
parentf43c11497df6550ac224e0965b7a07d4c548055b (diff)
fixed crash when switching to an instance with a lower refresh thread count
fixed rare race condition when waking up handle closer threads
-rw-r--r--src/envfs.cpp6
-rw-r--r--src/envfs.h9
2 files changed, 14 insertions, 1 deletions
diff --git a/src/envfs.cpp b/src/envfs.cpp
index a67faf84..4aaef082 100644
--- a/src/envfs.cpp
+++ b/src/envfs.cpp
@@ -173,7 +173,11 @@ public:
void wakeup()
{
- m_ready = true;
+ {
+ std::unique_lock lock(m_mutex);
+ m_ready = true;
+ }
+
m_cv.notify_one();
}
diff --git a/src/envfs.h b/src/envfs.h
index 8790b071..bbc27005 100644
--- a/src/envfs.h
+++ b/src/envfs.h
@@ -128,6 +128,15 @@ private:
thread = std::thread([&]{ run(); });
}
+ ~ThreadInfo()
+ {
+ if (thread.joinable()) {
+ stop = true;
+ wakeup();
+ thread.join();
+ }
+ }
+
void wakeup()
{
{