userlibandfileserver/fileserver/sfile/sf_pool.cpp
changeset 299 b5a01337d018
parent 245 647ab20fee2e
--- a/userlibandfileserver/fileserver/sfile/sf_pool.cpp	Tue Oct 26 12:49:20 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_pool.cpp	Mon Nov 01 20:11:36 2010 +0000
@@ -23,13 +23,13 @@
 //=====CFsPool=============================
 
 template <class T>
-CFsPool<T>* CFsPool<T>::New(TInt aPoolSize)
+CFsPool<T>* CFsPool<T>::New(TInt aPoolSize, T*(*aNewFunction)())
 	{
 	CFsPool<T>* pool = new CFsPool<T>();
 	if(!pool)
 		return NULL;
 	
-	TInt r = pool->Construct(aPoolSize);
+	TInt r = pool->Construct(aPoolSize,aNewFunction);
 	if(r!=KErrNone)
 		{
 		delete pool;
@@ -46,20 +46,20 @@
 	}
 
 template <class T>
-TInt CFsPool<T>::Construct(TInt aPoolSize)
+TInt CFsPool<T>::Construct(TInt aPoolSize,T*(*aNewFunction)())
 	{
-	TInt r = iPoolLock.CreateLocal(KNotificationPoolSize);
+	TInt r = iPoolLock.CreateLocal(aPoolSize);
 	if(r != KErrNone)
 			return r;
 	
-	r = iFreeList.Reserve(KNotificationPoolSize);
+	r = iFreeList.Reserve(aPoolSize);
 	if(r != KErrNone)
 		return r;
 	
 	TInt i = 0;
 	while(i < aPoolSize)
 		{
-		T* t = T::New();
+		T* t = aNewFunction();
 		if(!t)
 			{
 			return KErrNoMemory;
@@ -120,9 +120,9 @@
 	iPoolLock.Signal();
 	}
 
+//These are needed here because the compiler needs to know which types will be 
+//instantiating the template (because it's in a separate file)
 #ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION	
-//This is needed here because the compiler needs to know which types will be 
-//instantiating the template (because it's in a separate file)
 template class CFsPool<CFsNotificationBlock>;
 #endif //SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION	
-
+template class CFsPool<CFsNotificationInfo>;