From 4acb9be4d24f7e5448a0e5702b77ebfe2efdbb7e Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 5 Mar 2017 01:01:08 +0100 Subject: [PATCH] Library: singleton / lib::Depend should be rewritten eventually (#1086) --- src/lib/depend.hpp | 4 ++-- src/lib/dependency-factory.hpp | 1 - src/lib/singleton-ref.hpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/depend.hpp b/src/lib/depend.hpp index a12c998e5..5110789fd 100644 --- a/src/lib/depend.hpp +++ b/src/lib/depend.hpp @@ -98,6 +98,7 @@ namespace lib { * the singleton ctor to be flushed and visible to other threads when releasing the lock? * To my understanding, the answer is yes. See * [POSIX](http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap04.html#tag_04_10) + * @todo as of 2016, the design could still be improved //////////////////////////////////////////TICKET #1086 * @param SI the class of the Singleton instance */ template @@ -148,8 +149,7 @@ namespace lib { * this configuration must be done \em prior to any use the dependency factory. * @param ctor a constructor function, which will be invoked on first usage. * @note basically a custom constructor function is responsible to manage any - * created service instances. Optionally it may install a deleter function - * via \c DependencyFactory::scheduleDestruction(void*,KillFun) + * created service instances. * @remark typically the \c Depend factory will be placed into a static variable, * embedded into another type or interface. In this case, actual storage for * this static variable needs to be allocated within some translation unit. diff --git a/src/lib/dependency-factory.hpp b/src/lib/dependency-factory.hpp index 818015bc9..f09848ad8 100644 --- a/src/lib/dependency-factory.hpp +++ b/src/lib/dependency-factory.hpp @@ -52,7 +52,6 @@ namespace lib { { public: typedef void* (*InstanceConstructor)(void); - typedef void (*KillFun) (void*); /** ensure initialisation by installing a default constructor function, * but don't change an explicitly installed different constructor function. diff --git a/src/lib/singleton-ref.hpp b/src/lib/singleton-ref.hpp index a7550da41..14ee74ec6 100644 --- a/src/lib/singleton-ref.hpp +++ b/src/lib/singleton-ref.hpp @@ -76,7 +76,7 @@ namespace lib { close () { ASSERT (obj_, "Lifecycle error"); - obj_ = 0; + obj_ = nullptr; } TY*