diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-06-12 14:22:22 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-06-12 14:22:22 +0700 |
commit | b9b7b3d525c9bbcca07ea47e7595fe36e47265ea (patch) | |
tree | dc88a26b5a0c871d36347ee872397e767dadc554 /crypto/src | |
parent | Performance optimization (diff) | |
download | BouncyCastle.NET-ed25519-b9b7b3d525c9bbcca07ea47e7595fe36e47265ea.tar.xz |
Add locking to lazy factory property
Diffstat (limited to 'crypto/src')
-rw-r--r-- | crypto/src/asn1/x9/X9ECParametersHolder.cs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/crypto/src/asn1/x9/X9ECParametersHolder.cs b/crypto/src/asn1/x9/X9ECParametersHolder.cs index b3455709c..f0a320094 100644 --- a/crypto/src/asn1/x9/X9ECParametersHolder.cs +++ b/crypto/src/asn1/x9/X9ECParametersHolder.cs @@ -8,13 +8,16 @@ namespace Org.BouncyCastle.Asn1.X9 { get { - if (parameters == null) - { - parameters = CreateParameters(); - } + lock (this) + { + if (parameters == null) + { + parameters = CreateParameters(); + } - return parameters; - } + return parameters; + } + } } protected abstract X9ECParameters CreateParameters(); |