Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# run a process Pin
Eddy Vluggen18-Feb-13 8:30
professionalEddy Vluggen18-Feb-13 8:30 
GeneralRe: C# run a process Pin
classy_dog18-Feb-13 14:04
classy_dog18-Feb-13 14:04 
GeneralRe: C# run a process Pin
Eddy Vluggen18-Feb-13 22:31
professionalEddy Vluggen18-Feb-13 22:31 
GeneralRe: C# run a process Pin
classy_dog19-Feb-13 5:38
classy_dog19-Feb-13 5:38 
GeneralRe: C# run a process Pin
Eddy Vluggen19-Feb-13 9:34
professionalEddy Vluggen19-Feb-13 9:34 
QuestionThread.Sleep is NOT evil Pin
devvvy18-Feb-13 5:55
devvvy18-Feb-13 5:55 
AnswerRe: Thread.Sleep is NOT evil Pin
Pete O'Hanlon18-Feb-13 6:15
mvePete O'Hanlon18-Feb-13 6:15 
GeneralRe: Thread.Sleep is NOT evil Pin
devvvy18-Feb-13 13:29
devvvy18-Feb-13 13:29 
SCENARIO 1 - wait for task completion on another thread: I agree as I stated earlier not to use Thread.Sleep and that it's just outright wrong to do so.

SCENARIO 2 - humble timing while loop: I'm not hearing any reason not to use it. As indicated
* just because it's simple doesn't mean it's inappropriate
* the thread which host the while loop needs be created anyway so thread creation cost is irrelevant
* most applications don't need to know when *exactly* the blocked thread needs to *wake* up after specified period
* alternative is to use a timer+event/subscriber which does nothing more than complicate an otherwise cannot-be-simpler while loop with a Thread.Sleep

SCENARIO 3 Thread.Sleep(MagicDuration) or app breaks - well... this is a bug which demands correction in the first place.

I'm not hearing any new argument in support of not using Thread.Sleep in SCENARIO 2 -
- SCENARIO 1/3 is just plain stupid for anyone to use Thread.Sleep
- SCENARIO 2 not using simple Thread.Sleep is just waste of *my* time
This is an over discussed subject, gives people wrong impression this is actually complicated, that Thread.Sleep is really evil.
dev

GeneralRe: Thread.Sleep is NOT evil Pin
N a v a n e e t h18-Feb-13 16:12
N a v a n e e t h18-Feb-13 16:12 
GeneralTHANK YOU - this is the answer I was looking for. Pin
devvvy19-Feb-13 12:53
devvvy19-Feb-13 12:53 
GeneralRe: Thread.Sleep is NOT evil Pin
Pete O'Hanlon18-Feb-13 20:43
mvePete O'Hanlon18-Feb-13 20:43 
GeneralApplication Exit vs Thread.Abort? Pin
devvvy19-Feb-13 13:12
devvvy19-Feb-13 13:12 
GeneralRe: Thread.Sleep is NOT evil Pin
Simon_Whale18-Feb-13 13:41
Simon_Whale18-Feb-13 13:41 
GeneralRe: Thread.Sleep is NOT evil Pin
N a v a n e e t h18-Feb-13 16:15
N a v a n e e t h18-Feb-13 16:15 
GeneralRe: Thread.Sleep is NOT evil Pin
devvvy19-Feb-13 1:41
devvvy19-Feb-13 1:41 
GeneralRe: Thread.Sleep is NOT evil Pin
Pete O'Hanlon19-Feb-13 2:18
mvePete O'Hanlon19-Feb-13 2:18 
GeneralRe: Thread.Sleep is NOT evil Pin
N a v a n e e t h19-Feb-13 6:33
N a v a n e e t h19-Feb-13 6:33 
GeneralRe: Thread.Sleep is NOT evil Pin
devvvy19-Feb-13 12:47
devvvy19-Feb-13 12:47 
GeneralRe: Thread.Sleep is NOT evil Pin
devvvy19-Feb-13 12:35
devvvy19-Feb-13 12:35 
GeneralRe: Thread.Sleep is NOT evil Pin
Pete O'Hanlon19-Feb-13 13:06
mvePete O'Hanlon19-Feb-13 13:06 
GeneralApplication exit: Valid concern for SCENARIO 2 from Pete (Big thank you!) Pin
devvvy19-Feb-13 13:30
devvvy19-Feb-13 13:30 
GeneralRe: Thread.Sleep is NOT evil Pin
N a v a n e e t h19-Feb-13 6:36
N a v a n e e t h19-Feb-13 6:36 
GeneralRe: Thread.Sleep is NOT evil Pin
devvvy19-Feb-13 12:36
devvvy19-Feb-13 12:36 
AnswerRe: Thread.Sleep is NOT evil Pin
Dave Kreskowiak18-Feb-13 15:52
mveDave Kreskowiak18-Feb-13 15:52 
GeneralRe: Thread.Sleep is NOT evil Pin
devvvy19-Feb-13 1:38
devvvy19-Feb-13 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.