kernel/eka/kernel/sprocess.cpp
branchRCL_3
changeset 43 c1f20ce4abcf
parent 42 a179b74831c9
child 44 3e88ff8f41d5
--- a/kernel/eka/kernel/sprocess.cpp	Thu Aug 19 11:14:22 2010 +0300
+++ b/kernel/eka/kernel/sprocess.cpp	Tue Aug 31 16:34:26 2010 +0300
@@ -324,7 +324,7 @@
 
 	iGeneration = NextGeneration(aName, iUids.iUid[2]);
 
-	__KTRACE_OPT(KTHREAD,Kern::Printf("DProcess::Rename %O to %lS",this,&aName));
+	__KTRACE_OPT(KTHREAD,Kern::Printf("DProcess::Rename %O to %S",this,&aName));
 	TInt r = SetName(&aName);
 #ifdef BTRACE_THREAD_IDENTIFICATION
 	Name(n);
@@ -342,7 +342,6 @@
 	if (iSMPUnsafeGroup)
 		{
 		NKern::GroupDestroy(iSMPUnsafeGroup);
-		Kern::Free(iSMPUnsafeGroup);
 		}
 #endif
 
@@ -531,7 +530,7 @@
 // Kill a process. Enter and return with system unlocked and calling thread in critical section.
 //
 	{
-	__KTRACE_OPT(KPROC,Kern::Printf("Process %O Die: %d %d %lS",this,aType,aReason,&aCategory));
+	__KTRACE_OPT(KPROC,Kern::Printf("Process %O Die: %d %d %S",this,aType,aReason,&aCategory));
 
 	TInt r=WaitProcessLock();
 	if (r!=KErrNone)
@@ -623,7 +622,7 @@
 TInt DProcess::NewThread(DThread*& aThread, SThreadCreateInfo& anInfo, TInt* aHandle, TOwnerType aType)
 	{
 	__KTRACE_OPT(KTHREAD,Kern::Printf("NewThread proc %O, func %08x ptr %08x",this,anInfo.iFunction,anInfo.iPtr));
-	__KTRACE_OPT(KTHREAD,Kern::Printf("type %d name %lS pri %d",anInfo.iType,&anInfo.iName,anInfo.iInitialThreadPriority));
+	__KTRACE_OPT(KTHREAD,Kern::Printf("type %d name %S pri %d",anInfo.iType,&anInfo.iName,anInfo.iInitialThreadPriority));
 	if (aHandle)
 		*aHandle=0;
 	TInt r=GetNewThread(aThread,anInfo);
@@ -736,6 +735,11 @@
 	}
 
 #ifdef __SMP__
+void SMPUnsafeGroupDestroyFn(TAny* aGroup)
+	{
+	Kern::Free(aGroup);
+	}
+
 TInt DProcess::UpdateSMPSafe()
 	{
 	TUint32 config = TheSuperPage().KernelConfigFlags();
@@ -749,10 +753,21 @@
 		{
 		SNThreadGroupCreateInfo info;
 		info.iCpuAffinity = KCpuAffinityAny;
-		iSMPUnsafeGroup = (NThreadGroup*)Kern::Alloc(sizeof(NThreadGroup));
+		NThreadGroup* g = (NThreadGroup*)Kern::Alloc(sizeof(NThreadGroup));
 		r = KErrNoMemory;
-		if (iSMPUnsafeGroup)
-			r = NKern::GroupCreate(iSMPUnsafeGroup, info);
+		if (g)
+			{
+			info.iDestructionDfc = new TDfc(&SMPUnsafeGroupDestroyFn, g, K::SvMsgQ, 2);
+			if (info.iDestructionDfc)
+				r = NKern::GroupCreate(g, info);
+			if (r != KErrNone)
+				{
+				delete info.iDestructionDfc;
+				Kern::Free(g);
+				g = 0;
+				}
+			iSMPUnsafeGroup = g;
+			}
 		}
 	if (r==KErrNone)
 		{