Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Ungureanu <marius.ungureanu@xamarin.com>2015-01-04 17:40:45 +0300
committerMarius Ungureanu <marius.ungureanu@xamarin.com>2015-01-13 19:18:38 +0300
commit517f0138777ce0dcbeca51f1f5cb7fe40b70ab36 (patch)
treeafdac5a7c6b7495a499e7e5f0a38fb15db7a4bd6 /main/src/addins/MonoDevelop.SourceEditor2
parente2f69a5b6641d9d771f67cbe3f4b1c67bd9051ff (diff)
[Performance] Made autosave do less IO on gui thread.
This involves undo operations too, visible boost of performance.
Diffstat (limited to 'main/src/addins/MonoDevelop.SourceEditor2')
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs
index 70b53bfe00..c96c5161bb 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs
@@ -122,7 +122,8 @@ namespace MonoDevelop.SourceEditor
}
}
- static AutoResetEvent resetEvent = new AutoResetEvent (false);
+ static readonly AutoResetEvent resetEvent = new AutoResetEvent (false);
+ static readonly AutoResetEvent saveEvent = new AutoResetEvent (false);
static bool autoSaveThreadRunning = false;
static Thread autoSaveThread;
static Queue<FileContent> queue = new Queue<FileContent> ();
@@ -148,18 +149,23 @@ namespace MonoDevelop.SourceEditor
// Don't create an auto save for unsaved files.
if (string.IsNullOrEmpty (content.FileName))
continue;
+ string text = null;
+ bool set = false;
Application.Invoke (delegate {
- string text;
try {
text = content.Content.Text;
+ set = true;
} catch (Exception e) {
LoggingService.LogError ("Exception in auto save thread.", e);
return;
+ } finally {
+ saveEvent.Set();
}
- CreateAutoSave (content.FileName, text);
}
);
-
+ saveEvent.WaitOne ();
+ if (set)
+ CreateAutoSave (content.FileName, text);
}
}
}