public void Foo(IRB inR) {
Stopwatch sw = new Stopwatch();
sw.Start();
System.Threading.Thread theThread = new System.Threading.Thread(delegate() {
if (inR.Ready) {
inR.ABC();
while (!inR.Ready) { Thread.Sleep(100); }
}
mP.CP = false;
});
theThread.Name = "aaabbbccc";
theThread.Start();
}
So, I want use StopWatch measuring the time that “theThread” running. (Actually, I want to measure time from creating of this thread to end of thread.)
I already put stopwatch.start() where I want. But where should I put my stopwatch.stop()?
Thank you.
Why not put the stopwatch code in the thread itself? For example:
Then: