diff options
author | Marius Ungureanu <teromario@yahoo.com> | 2015-02-03 21:43:15 +0300 |
---|---|---|
committer | Marius Ungureanu <teromario@yahoo.com> | 2015-02-03 21:43:15 +0300 |
commit | 2f12f3d6752144ddbcd5a608bb87781190b04013 (patch) | |
tree | e8032b0e88bddd1cfe4089a4de9eed9e59000708 /main/src/addins/MonoDevelop.SourceEditor2 | |
parent | ee943316c671ecae5768fb42edff0eb3a527a63a (diff) | |
parent | 52cdd14ddbf9cc58c9e58b6ff6003bba00eb5891 (diff) |
Merge pull request #691 from mono/perfImprovements
Performance Improvements
Diffstat (limited to 'main/src/addins/MonoDevelop.SourceEditor2')
-rw-r--r-- | main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs | 14 |
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); } } } |