Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to use thread in for loop in c# Pin
superselector19-Sep-13 21:50
superselector19-Sep-13 21:50 
GeneralRe: how to use thread in for loop in c# Pin
GuyThiebaut19-Sep-13 22:20
professionalGuyThiebaut19-Sep-13 22:20 
GeneralRe: how to use thread in for loop in c# Pin
superselector19-Sep-13 23:08
superselector19-Sep-13 23:08 
GeneralRe: how to use thread in for loop in c# Pin
GuyThiebaut19-Sep-13 23:13
professionalGuyThiebaut19-Sep-13 23:13 
GeneralRe: how to use thread in for loop in c# Pin
Pete O'Hanlon19-Sep-13 22:34
mvePete O'Hanlon19-Sep-13 22:34 
GeneralRe: how to use thread in for loop in c# Pin
harold aptroot19-Sep-13 23:58
harold aptroot19-Sep-13 23:58 
GeneralRe: how to use thread in for loop in c# Pin
superselector23-Sep-13 18:51
superselector23-Sep-13 18:51 
GeneralRe: how to use thread in for loop in c# Pin
harold aptroot23-Sep-13 21:08
harold aptroot23-Sep-13 21:08 
Ok, it's a little tricky.

The simplest way, not very good is: make one thread for every ping action, start them all, then Join them all. Is that good enough for you?

Otherwise, use ping.SendAsync, and make very sure that PingCompletedEventHandler is thread-safe. The handler will have to 1) save the result (safely! may involve locking) and 2) signal a waithandle (after saving the result). Then you can do a WaitAll over all the waithandles to continue when all the pings are done.
GeneralRe: how to use thread in for loop in c# Pin
superselector23-Sep-13 21:24
superselector23-Sep-13 21:24 
GeneralRe: how to use thread in for loop in c# Pin
harold aptroot23-Sep-13 21:28
harold aptroot23-Sep-13 21:28 
GeneralRe: how to use thread in for loop in c# Pin
superselector23-Sep-13 22:31
superselector23-Sep-13 22:31 
GeneralRe: how to use thread in for loop in c# Pin
harold aptroot23-Sep-13 22:33
harold aptroot23-Sep-13 22:33 
GeneralRe: how to use thread in for loop in c# Pin
superselector23-Sep-13 22:39
superselector23-Sep-13 22:39 
GeneralRe: how to use thread in for loop in c# Pin
harold aptroot23-Sep-13 23:15
harold aptroot23-Sep-13 23:15 
GeneralRe: how to use thread in for loop in c# Pin
superselector23-Sep-13 23:39
superselector23-Sep-13 23:39 
GeneralRe: how to use thread in for loop in c# Pin
harold aptroot23-Sep-13 23:59
harold aptroot23-Sep-13 23:59 
GeneralRe: how to use thread in for loop in c# Pin
superselector24-Sep-13 0:50
superselector24-Sep-13 0:50 
GeneralRe: how to use thread in for loop in c# Pin
harold aptroot24-Sep-13 0:54
harold aptroot24-Sep-13 0:54 
GeneralRe: how to use thread in for loop in c# Pin
superselector24-Sep-13 1:17
superselector24-Sep-13 1:17 
GeneralRe: how to use thread in for loop in c# Pin
superselector24-Sep-13 1:50
superselector24-Sep-13 1:50 
GeneralRe: how to use thread in for loop in c# Pin
harold aptroot24-Sep-13 4:33
harold aptroot24-Sep-13 4:33 
AnswerRe: how to use thread in for loop in c# Pin
Abhinav S19-Sep-13 23:15
Abhinav S19-Sep-13 23:15 
AnswerRe: how to use thread in for loop in c# Pin
Simon_Whale19-Sep-13 23:55
Simon_Whale19-Sep-13 23:55 
GeneralRe: how to use thread in for loop in c# Pin
superselector22-Sep-13 19:29
superselector22-Sep-13 19:29 
Questionasp.net enterprise application Pin
Member 882441719-Sep-13 8:26
Member 882441719-Sep-13 8:26 

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.