提交 f3801728 authored 作者: Andrei Tokar's avatar Andrei Tokar

stop background writer thread when panic() happened on it

上级 81bd7b8f
...@@ -2845,10 +2845,10 @@ public class MVStore implements AutoCloseable { ...@@ -2845,10 +2845,10 @@ public class MVStore implements AutoCloseable {
// which should not happen with non-weak flavour of CAS operation, // which should not happen with non-weak flavour of CAS operation,
// but I've seen it, so just to be safe... // but I've seen it, so just to be safe...
BackgroundWriterThread t; BackgroundWriterThread t;
while ((t = backgroundWriterThread.get()) != null && while ((t = backgroundWriterThread.get()) != null) {
// if called from within the thread itself - can not join
t != Thread.currentThread()) {
if (backgroundWriterThread.compareAndSet(t, null)) { if (backgroundWriterThread.compareAndSet(t, null)) {
// if called from within the thread itself - can not join
if (t != Thread.currentThread()) {
synchronized (t.sync) { synchronized (t.sync) {
t.sync.notifyAll(); t.sync.notifyAll();
} }
...@@ -2860,6 +2860,7 @@ public class MVStore implements AutoCloseable { ...@@ -2860,6 +2860,7 @@ public class MVStore implements AutoCloseable {
// ignore // ignore
} }
} }
}
break; break;
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论