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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2015-12-16 20:05:45 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2015-12-16 20:05:45 +0300
commitcd62639d9c8074fd1ccf56f5847d2faf33e4d40a (patch)
treef6ff4ba56490f264f3805e0b8fb979858e0f9b29 /mcs
parent8e8abf2a8f4d57b1d095377f4ec97e0845c0c6a5 (diff)
parent7a79d9d7e679fb4f7e0f32025ffcba9321e7849f (diff)
Merge pull request #2324 from akoeplinger/caching-locking
[System.Runtime.Caching] Add missing locking when accessing cache entries
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.Runtime.Caching/ReferenceSources/CacheEntryCollection.cs16
1 files changed, 9 insertions, 7 deletions
diff --git a/mcs/class/System.Runtime.Caching/ReferenceSources/CacheEntryCollection.cs b/mcs/class/System.Runtime.Caching/ReferenceSources/CacheEntryCollection.cs
index 60f89fd8ad6..7925d6a6f62 100644
--- a/mcs/class/System.Runtime.Caching/ReferenceSources/CacheEntryCollection.cs
+++ b/mcs/class/System.Runtime.Caching/ReferenceSources/CacheEntryCollection.cs
@@ -68,15 +68,17 @@ namespace System.Runtime.Caching
if (blockInsert)
store.BlockInsert ();
- foreach (var entry in entries) {
- if (helper.GetDateTime (entry) > limit || flushedItems >= count)
- break;
+ lock (entries) {
+ foreach (var entry in entries) {
+ if (helper.GetDateTime (entry) > limit || flushedItems >= count)
+ break;
- flushedItems++;
- }
+ flushedItems++;
+ }
- for (var f = 0; f < flushedItems; f++)
- store.Remove (entries.Min, null, reason);
+ for (var f = 0; f < flushedItems; f++)
+ store.Remove (entries.Min, null, reason);
+ }
if (blockInsert)
store.UnblockInsert ();