Skip to content

Commit

Permalink
Dump log synchronously if we are about to dispose of it.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugues Valois committed Nov 30, 2017
1 parent eb75291 commit b09e261
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Python/Product/Analysis/AnalysisLogWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,14 @@ public void Flush(bool synchronous = false) {
}

private void Dump() {
if (!_dumping.Wait(0)) {
try {
if (!_dumping.Wait(0)) {
return;
}
} catch (ObjectDisposedException) {
return;
}

try {
// Once triggered, allow any more immediate messages to be added.
Thread.Sleep(50);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void Dispose() {
protected void Dispose(bool disposing) {
if (!_disposed) {
_disposed = true;
_log?.Flush(!disposing);
_log?.Flush(synchronous: true);

if (disposing) {
if (_log != null) {
Expand Down

0 comments on commit b09e261

Please sign in to comment.