diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-06-26 15:48:35 +1000 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-06-26 15:48:35 +1000 |
commit | 792bde87f249328fcefb8e468cda50f418797e86 (patch) | |
tree | 71ef9a929fe74d771a7b1cf4feb568606fe2e210 /crypto/src/asn1 | |
parent | Latest custom EC updates from Java API (diff) | |
download | BouncyCastle.NET-ed25519-792bde87f249328fcefb8e468cda50f418797e86.tar.xz |
Move lazy initialization under lock
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r-- | crypto/src/asn1/x9/X9ECParametersHolder.cs | 35 |
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(); + } } |