From ee88b68a7c7476508c5bd42b902d36befc59d92b Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sat, 28 Mar 2015 17:49:30 +0100 Subject: [PATCH] Remove unnecessary initOnce The class is synchronized now. Calls to getInstance is already barricaded by the class-level monitor. --- source/poodinis/container.d | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/poodinis/container.d b/source/poodinis/container.d index 32e6fb6..fff7026 100644 --- a/source/poodinis/container.d +++ b/source/poodinis/container.d @@ -273,6 +273,9 @@ synchronized class DependencyContainer { */ public static shared(DependencyContainer) getInstance() { static shared DependencyContainer instance; - return initOnce!instance(new DependencyContainer()); + if (instance is null) { + instance = new DependencyContainer(); + } + return instance; } }