kerneltest/e32test/pccd/d_medch.cpp
changeset 31 56f325a607ea
parent 0 a41df078684a
--- a/kerneltest/e32test/pccd/d_medch.cpp	Mon Dec 21 16:14:42 2009 +0000
+++ b/kerneltest/e32test/pccd/d_medch.cpp	Wed Dec 23 11:43:31 2009 +0000
@@ -24,6 +24,9 @@
 const TInt KMinorVersionNumber=0;
 const TInt KBuildVersionNumber=1;
 
+_LIT(KDFCThreadName,"D_MEDCH_DFC_THREAD");
+const TInt KMedChThreadPriority = 27;
+
 class DLddFactoryMedCh : public DLogicalDevice
 	{
 public:
@@ -50,6 +53,7 @@
 	DPBusSocket* iSocketP;
 	DThread* iClient;
 	TRequestStatus* iReqStat;
+	TDynamicDfcQue* iDfcQ;
 	
 	NTimer iMsCallBack;
 	TInt iMsInterval;
@@ -124,6 +128,9 @@
 		(void)iSocketP->ControlIO(DPBusSocket::EControlMediaState, (TAny*)DPBusSocket::EPeriphBusMediaNormal, NULL);
 
 	Kern::SafeClose((DObject*&)iClient, NULL);
+
+	if (iDfcQ)
+		iDfcQ->Destroy();
 	}
 
 TInt DLddMedCh::DoCreate(TInt aUnit, const TDesC8* /*aInfo*/, const TVersion& aVer)
@@ -142,7 +149,18 @@
 	if(iSocketP == NULL)
 		return(KErrNoMemory);
 
-	SetDfcQ(Kern::DfcQue0());
+	if (!iDfcQ)
+ 			{
+ 			TInt r = Kern::DynamicDfcQCreate(iDfcQ, KMedChThreadPriority, KDFCThreadName);
+			if (r != KErrNone)
+ 				return r;
+#ifdef CPU_AFFINITY_ANY
+			NKern::ThreadSetCpuAffinity((NThread*)(iDfcQ->iThread), KCpuAffinityAny);			
+#endif
+
+			SetDfcQ(iDfcQ);
+ 			}	
+
 	iMsgQ.Receive();
 	
     return KErrNone;