Library: singleton / lib::Depend should be rewritten eventually (#1086)

This commit is contained in:
Fischlurch 2017-03-05 01:01:08 +01:00
parent c068779a80
commit 4acb9be4d2
3 changed files with 3 additions and 4 deletions

View file

@ -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<class SI>
@ -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<TY> 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.

View file

@ -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.

View file

@ -76,7 +76,7 @@ namespace lib {
close ()
{
ASSERT (obj_, "Lifecycle error");
obj_ = 0;
obj_ = nullptr;
}
TY*