summary refs log tree commit diff
path: root/crypto/src/asn1/x9/X9ECParametersHolder.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-06-26 15:48:35 +1000
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-06-26 15:48:35 +1000
commit792bde87f249328fcefb8e468cda50f418797e86 (patch)
tree71ef9a929fe74d771a7b1cf4feb568606fe2e210 /crypto/src/asn1/x9/X9ECParametersHolder.cs
parentLatest custom EC updates from Java API (diff)
downloadBouncyCastle.NET-ed25519-792bde87f249328fcefb8e468cda50f418797e86.tar.xz
Move lazy initialization under lock
Diffstat (limited to '')
-rw-r--r--crypto/src/asn1/x9/X9ECParametersHolder.cs35
1 files changed, 19 insertions, 16 deletions
diff --git a/crypto/src/asn1/x9/X9ECParametersHolder.cs b/crypto/src/asn1/x9/X9ECParametersHolder.cs
index b3455709c..dd59e9f56 100644
--- a/crypto/src/asn1/x9/X9ECParametersHolder.cs
+++ b/crypto/src/asn1/x9/X9ECParametersHolder.cs
@@ -1,22 +1,25 @@
 namespace Org.BouncyCastle.Asn1.X9
 {
-	public abstract class X9ECParametersHolder
-	{
-		private X9ECParameters parameters;
+    public abstract class X9ECParametersHolder
+    {
+        private X9ECParameters parameters;
 
-		public X9ECParameters Parameters
-		{
-			get
-			{
-				if (parameters == null)
-				{
-					parameters = CreateParameters();
-				}
+        public X9ECParameters Parameters
+        {
+            get
+            {
+                lock (this)
+                {
+                    if (parameters == null)
+                    {
+                        parameters = CreateParameters();
+                    }
 
-				return parameters;
-			}
-		}
+                    return parameters;
+                }
+            }
+        }
 
-		protected abstract X9ECParameters CreateParameters();
-	}
+        protected abstract X9ECParameters CreateParameters();
+    }
 }