Skip to content

Commit c11e0f9

Browse files
committed
Remove unnecessary locking
- see bcgit/bc-java#778
1 parent a0470b2 commit c11e0f9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

crypto/src/math/ec/ECCurve.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,18 +433,17 @@ public virtual ECEndomorphism GetEndomorphism()
433433
}
434434

435435
/**
436-
* Sets the default <code>ECMultiplier</code>, unless already set.
436+
* Sets the default <code>ECMultiplier</code>, unless already set.
437+
*
438+
* We avoid locking for performance reasons, so there is no uniqueness guarantee.
437439
*/
438440
public virtual ECMultiplier GetMultiplier()
439441
{
440-
lock (this)
442+
if (this.m_multiplier == null)
441443
{
442-
if (this.m_multiplier == null)
443-
{
444-
this.m_multiplier = CreateDefaultMultiplier();
445-
}
446-
return this.m_multiplier;
444+
this.m_multiplier = CreateDefaultMultiplier();
447445
}
446+
return this.m_multiplier;
448447
}
449448

450449
/**

0 commit comments

Comments
 (0)