TwiN / design-patterns

0 stars 0 forks source link

Implement `Double-checked locking` #1

Open marc-x-andre opened 6 years ago

marc-x-andre commented 6 years ago

Issues Type

Description

Implement Double-checked locking

Reduce the overhead of acquiring a lock by first testing the locking criterion (the 'lock hint') in an unsafe manner; only if that succeeds does the actual locking logic proceed.

Warning Can be unsafe when implemented in some language/hardware combinations. It can therefore sometimes be considered an anti-pattern.