Thread.Sleep is NOT evil
-
it's a simple reliable picture box. if people use it for SCENARIO 1/3 it's just absurb in the first place. but SCENARIO 2 it's just not much to talk about - the fact there is simply because people wasting each other time trying to complicate otherwise very simple Thread.Sleep
dev
Oh but Thread.Sleep is not so simple. Using it has vast implications on the functionality of the rest of your app. That's why so many noobs use it and can't figure out why their app doesn't work properly or, as you mentioned, you can't shutdown a service without timing out the Service Manager.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
Oh but Thread.Sleep is not so simple. Using it has vast implications on the functionality of the rest of your app. That's why so many noobs use it and can't figure out why their app doesn't work properly or, as you mentioned, you can't shutdown a service without timing out the Service Manager.
A guide to posting questions on CodeProject[^]
Dave KreskowiakI saw two arguments against using Thread.Sleep for scenario 2 a. From you: Thread.Sleep screw up message pump IF you do this on UI Thread (But why'd you Thread.Sleep on UI in the first place!) b. From Pete: Application exit Both are valid arguments - But I don't think I stumble across these in other places at all. They deserve more visibility I now agree - Thread.Sleep is evil. (And can be replaced/avoided by one line timer+handler if you wrap it up in one blocking function call) Thank you!
dev