Changeset c6a59b for src/CodePatterns/Singleton_impl.hpp
- Timestamp:
- May 5, 2016, 1:06:20 PM (9 years ago)
- Children:
- c1e104
- Parents:
- 039e15
- git-author:
- Frederik Heber <heber@…> (05/05/16 09:20:08)
- git-committer:
- Frederik Heber <heber@…> (05/05/16 13:06:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodePatterns/Singleton_impl.hpp
r039e15 rc6a59b 45 45 } 46 46 return *theInstance; 47 } 48 49 template <class T,bool _may_create> 50 AtomicInstance<T> Singleton<T,_may_create>::getLockedInstance(){ 51 // boost supports RAII-Style locking, so we don't need to unlock 52 boost::recursive_mutex::scoped_lock guard(instanceLock); 53 if(!theInstance.get()) { 54 theInstance.reset(creator::make()); 55 } 56 T *ptr = theInstance.get(); 57 return AtomicInstance<T>(ptr); 47 58 } 48 59 … … 120 131 template name& Singleton< name , name::may_create >::getInstance(); \ 121 132 template const name& Singleton< name , name::may_create >::getConstInstance(); \ 133 template AtomicInstance<name> Singleton< name , name::may_create >::getLockedInstance(); \ 122 134 template name* Singleton< name , name::may_create >::getPointer(); \ 123 135 template const name* Singleton< name , name::may_create >::getConstPointer(); \
Note:
See TracChangeset
for help on using the changeset viewer.