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 just the current thread, and how should I deal with an issue like this?