7 #ifndef __thread_CountedPool_h__ 8 #define __thread_CountedPool_h__ 10 #define FE_CP_DEBUG FALSE 12 #define FE_CP_TSS (FE_USE_TSS && FE_OS!=FE_WIN32 && \ 13 FE_OS!=FE_WIN64 && FE_OS!=FE_OSX) 15 #define FE_CP_TSS_CLEANUP FE_CP_TSS 27 CountedPoolCore(
void) {}
28 virtual ~CountedPoolCore(
void) {}
30 virtual sp<Counted>
get(void) {
return sp<Counted>(NULL); }
63 m_pTssArray=
new boost::thread_specific_ptr
70 feLog(
"CountedPool<T>::CountedPool %p %p %p\n",
71 this,m_pTssArray,m_pTssArray->get());
76 feLog(
"CountedPool<T>() TSS failed\n");
86 feLog(
"CountedPool<T>::~CountedPool %p %p %p\n",
87 this,m_pTssArray,m_pTssArray->get());
101 #if FE_CP_TSS_CLEANUP 102 static void cleanup(
Array<
sp<T> >* a_pArray);
106 boost::thread_specific_ptr< Array< sp<T> > >* m_pTssArray;
110 #if FE_CP_TSS_CLEANUP 115 feLog(
"CountedPool<T>::cleanup %p\n",a_pArray);
129 feLog(
"CountedPool<T>::get %p %p %p\n",
130 this,m_pTssArray,m_pTssArray->get());
137 if(!(pArray=m_pTssArray->get()))
140 m_pTssArray->reset(pArray);
142 feLog(
"CountedPool<T>::get new vector %p %p %p\n",
143 this,m_pTssArray,pArray);
149 const U32 size=array.size();
150 for(U32 m=0;m<size;m++)
152 FEASSERT(array[m].isValid());
153 FEASSERT(array[m]->count()>0);
155 feLog(
"CountedPool<T>::get %p %p %p %d/%d %d\n",
156 this,m_pTssArray,pArray,m,size,array[m]->count());
158 if(array[m]->count()>100)
161 feX(e_notInitialized,
"CountedPool<T>::get",
162 "excessive reference count" 163 " suggests uninitialized data");
165 if(array[m]->count()==1)
173 array.resize(size+1);
176 feLog(
"CountedPool<T>::get %p NEW %d %d\n",
177 this,size,array[size]->count());
Pool of Counted elements.
Definition: CountedPool.h:55
kernel
Definition: namespace.dox:3
Wrapper for std::vector.
Definition: Array.h:21
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53