Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I have many threading on my website

if i used thread.sleep what threads will be effected??

1. if every thread in a page

2. if 2 threads located in same page??
Posted
Comments
Xiao Ling 25-Nov-14 21:02pm    
Sleep only works for the current thread which calls the Sleep method.

It suspends only the thread in which it is called.

MSDN reference[^]

Something you could have found easily, why waste your time asking this?
 
Share this answer
 
Comments
Hidhoud1991 25-Nov-14 9:54am    
what if u have 2 threads running and u want to suspend only one of them
you r calling Thread.sleep(time) not by the thread name.
thats what confusing me
Dave Kreskowiak 25-Nov-14 10:41am    
Again, read the documentation.

The only thread that sleeps is the thread that calls Thread.Sleep. No other threads are affected.
Sinisa Hajnal 26-Nov-14 2:24am    
Sleep is static / shared method on Thread. You shouldn't call it from particular instance. And it puts to sleep ONLY the thread it was called from. Your other thread(s) keep running.
Place the Cursor in visual Studio on the Sleep call.
Hit F1 key
Read the MSDN-docu
Make it a habbit if some question about a .NET Framework method, object, whatever comes to your mind.
If nothing helps THEN write questions on CP
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900