square/dagger — pull request #189 by cgruber (2013-03-21 02:08:26+00:00)
Title: Add proper concurrency support to Singleton/Lazy bindings

Use double-check locking (with volatile) to guard Singleton and Lazy bindings from concurrent access without requiring the cost of a lock once the underlying object has been created. Also write a test for each that uses a latch to force the race condition.