kerneltest/e32test/benchmark/thread.cpp
branchRCL_3
changeset 41 0ffb4e86fcc9
parent 39 2bb754abd467
equal deleted inserted replaced
39:2bb754abd467 41:0ffb4e86fcc9
   163 		TRequestStatus st;
   163 		TRequestStatus st;
   164 		TInt r = child.Create(KNullDesC, Thread::KillingChild, 0x2000, NULL, NULL);
   164 		TInt r = child.Create(KNullDesC, Thread::KillingChild, 0x2000, NULL, NULL);
   165 		BM_ERROR(r, r == KErrNone);
   165 		BM_ERROR(r, r == KErrNone);
   166 		child.Logon(st);
   166 		child.Logon(st);
   167 		BMProgram::SetAbsPriority(RThread(), KBMPriorityLow);
   167 		BMProgram::SetAbsPriority(RThread(), KBMPriorityLow);
   168 		child.Resume();
   168 		TRequestStatus threadRunning;
   169 		User::After(1000); // Give the child thread a chance to run - killing it too earlier can leave the heap locked
   169 		child.Rendezvous(threadRunning);
       
   170 		child.Resume();
       
   171 		User::WaitForRequest(threadRunning);	// Wait for the thread to run before killing it.
   170 		BMProgram::SetAbsPriority(RThread(), KBMPriorityHigh);
   172 		BMProgram::SetAbsPriority(RThread(), KBMPriorityHigh);
   171 		TBMTicks t1;
   173 		TBMTicks t1;
   172 		::bmTimer.Stamp(&t1);
   174 		::bmTimer.Stamp(&t1);
   173 		child.Kill(KErrCancel);
   175 		child.Kill(KErrCancel);
   174 		User::WaitForRequest(st);
   176 		User::WaitForRequest(st);
   181 		}
   183 		}
   182 	}
   184 	}
   183 
   185 
   184 TInt Thread::KillingChild(TAny*)
   186 TInt Thread::KillingChild(TAny*)
   185 	{
   187 	{
       
   188 	RThread::Rendezvous(KErrNone);
   186 	User::WaitForAnyRequest();
   189 	User::WaitForAnyRequest();
   187 	return KErrNone;
   190 	return KErrNone;
   188 	}
   191 	}
   189 
   192 
   190 #define TLS_KEY ((TInt32) &Thread::SetTls)
   193 #define TLS_KEY ((TInt32) &Thread::SetTls)