From 6a989f03d51af1f1c7509a3d74ec86e5d872abcd Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Mon, 14 Jun 2010 11:17:42 +0000 Subject: [PATCH] Fixed race condition in Cache --- Core/Cache.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Core/Cache.cs b/Core/Cache.cs index f574735..e1f6ec4 100644 --- a/Core/Cache.cs +++ b/Core/Cache.cs @@ -22,7 +22,12 @@ namespace FLocal.Core { } } } - return this.cache[id]; + lock(id) { + if(this.cache.ContainsKey(id)) { + return this.cache[id]; + } + } + return this.get(id, getter); } public void delete(object id) {