Click here to Skip to main content
15,907,687 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: asp.net enterprise application Pin
Dave Kreskowiak19-Sep-13 13:22
mveDave Kreskowiak19-Sep-13 13:22 
GeneralRe: asp.net enterprise application Pin
Member 882441721-Sep-13 8:30
Member 882441721-Sep-13 8:30 
GeneralRe: asp.net enterprise application Pin
Dave Kreskowiak21-Sep-13 12:10
mveDave Kreskowiak21-Sep-13 12:10 
QuestionOPOS driver Pin
kropek19-Sep-13 2:02
kropek19-Sep-13 2:02 
AnswerRe: OPOS driver Pin
kropek19-Sep-13 2:02
kropek19-Sep-13 2:02 
AnswerRe: OPOS driver Pin
OriginalGriff19-Sep-13 3:46
mveOriginalGriff19-Sep-13 3:46 
QuestionAccessing properties of one property of a class, directly Pin
H.Goli19-Sep-13 1:15
H.Goli19-Sep-13 1:15 

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.