chillydk147
chillydk147

Reputation: 385

Calling Thread.sleep inside second Thread Object Method call

I'm not sure how this will work, I create a Thread object t1 and associate a method DoStuff, inside DoStuff I need to at some point call Thread.Sleep(1000); will this pause t1 or the main thread or both.

var t1 = new Thread(new ThreadStart(DoStuff));
t1.Start();

public void DoStuff()
{
//some code then
Thread.Sleep(1000);
}

Upvotes: 1

Views: 494

Answers (1)

AgentFire
AgentFire

Reputation: 9780

It will pause the t1 thread for sure, but why don't just test it out yourself?

Upvotes: 1

Related Questions