Organizational Research By

Surprising Reserch Topic

thread.sleep in asp.net


I'm simulating the comet live feed protocol for my site, so in my controller I'm adding

while(nothing_new && before_timeout){
  Thread.Sleep(1000);
}

but I noticed the whole website got slow after I added this feature. After debugging I concluded that when I call Thread.Sleep all the threads, even in other requests, are being blocked.

Why does Thread.Sleep block all threads, not only the current, and how to deal with an issue like this?

 

asked May 9, 2015 in Asp.Net by rajesh
0 votes
38 views



Related Hot Questions



Government Jobs Opening


...