Commit 3ace5eb
Fix DefaultWalletKeyManager thread unsafe initialization.
Because the field wasn't re-checked after acquiring the mutex lock, it's possible that a second thread had already initialized the field concurrently.
Worse, because the field isn't volatile, "concurrently" could have happened an arbitrarily long wall clock time ago, since the current thread isn't guaranteed to see a write to the field until after it acquires mutex.
This commit adds an extra check inside the mutex block in order to prevent this race condition.1 parent a468ac0 commit 3ace5eb
1 file changed
Lines changed: 2 additions & 0 deletions
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
0 commit comments