diff --git a/src/thread/SafeSingleton.hxx b/src/thread/SafeSingleton.hxx index ce2f4bb81..386c1f376 100644 --- a/src/thread/SafeSingleton.hxx +++ b/src/thread/SafeSingleton.hxx @@ -37,11 +37,12 @@ class SafeSingleton { static T *instance; public: - SafeSingleton() { + template + explicit SafeSingleton(Args&&... args) { const std::lock_guard lock(mutex); if (ref == 0) - instance = new T; + instance = new T(std::forward(args)...); /* increment after creating the instance; this way is exception-safe, because we must not increment the