kernel/eka/euser/us_test.cpp
changeset 90 947f0dc9f7a8
parent 0 a41df078684a
child 293 0659d0e1a03c
--- a/kernel/eka/euser/us_test.cpp	Tue Feb 02 01:24:03 2010 +0200
+++ b/kernel/eka/euser/us_test.cpp	Fri Apr 16 16:24:37 2010 +0300
@@ -549,6 +549,14 @@
 		User::AfterHighRes(period);
 		}
 	User::WaitForRequest(s);
+
+	// There is a potential race condition, if the calling thread runs on a different CPU
+	// than the Supervisor thread, which can result in this thread being signaled
+	// before the RHandleBase gets fully closed (see DChangeNotifier::Complete()).
+	// For that reason, wait until Supervisor thread gets to idle, which is the indication
+	// that Complete() function has returned (DThread::Close() was called releasing memory),
+	// in the case that Kernel heap was checked just after current method returns.
+	UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, (TAny*)timeout, NULL);
 	return r;
 	}