kernel/eka/kernel/sprocess.cpp
changeset 245 647ab20fee2e
parent 134 95847726fe57
--- a/kernel/eka/kernel/sprocess.cpp	Thu Aug 12 11:55:14 2010 +0100
+++ b/kernel/eka/kernel/sprocess.cpp	Thu Aug 12 12:51:24 2010 +0100
@@ -589,6 +589,16 @@
 		pLink=pLink->iNext;
 		if (pT!=pC)
 			{
+			// If killing pT will cause a system crash then force that to happen in the context of the
+			// current thread
+			if(pT->iFlags & KThreadFlagSystemPermanent)
+				{
+				K::Fault(K::EPermanentThreadExit);
+				}
+			if (aType != EExitKill && (pT->iFlags & KThreadFlagSystemCritical))
+				{
+				K::Fault(K::ESystemThreadPanic);
+				}
 			// Need to stop the current thread being killed as a consequence of killing pT
 			pT->iFlags &= ~(KThreadFlagProcessPermanent|KThreadFlagProcessCritical);
 			pT->Die(aType, aReason, aCategory);