diff options
author | Manish Sinha <manish.sinha@xamarin.com> | 2019-11-19 18:06:22 +0300 |
---|---|---|
committer | monojenkins <jo.shields+jenkins@xamarin.com> | 2019-11-20 05:57:36 +0300 |
commit | 6d237c68ba1265c14d388ef1ae4466bdd2b8df3f (patch) | |
tree | df019511494635c572d98fe509e1e0a96c62d4be /main | |
parent | 8a4dc4d3af6a735d0ff1659602784e57f5d89c73 (diff) |
[Core] lock values before creating ReadOnlyCollection from values
Diffstat (limited to 'main')
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/Counter.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/Counter.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/Counter.cs index 74ad5812b2..3322edb4fc 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/Counter.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/Counter.cs @@ -100,23 +100,29 @@ namespace MonoDevelop.Core.Instrumentation get { return this.logMessages; } set { this.logMessages = value; } } - + public int Count { get { return count; } } - + public bool Disposed { get { return disposed; } internal set { disposed = value; } } - + public int TotalCount { get { return totalCount; } } public virtual CounterDisplayMode DisplayMode => CounterDisplayMode.Block; - public IReadOnlyList<CounterValue> AllValues => new ReadOnlyCollection<CounterValue> (values); + public IReadOnlyList<CounterValue> AllValues { + get { + lock (values) { + return new ReadOnlyCollection<CounterValue> (values); + } + } + } public IEnumerable<CounterValue> GetValues () { |