
7stud
Enthusiast
Mar 18, 2010, 2:04 AM
Post #2 of 2
(2758 views)
|
Re: [guruk] Remote monitoring using multi-threading
[In reply to]
|
Can't Post
|
|
Why would you need to simultaneously test all 100 devices? You are going to be pinging them more than once right? Why can't you just use a while loop and poll each ip address in succession? If for some reason that won't work for you, a thread strategy might be to put all the ip addresses in a Thread::Queue, and then use threads::shared to share the queue between all the threads. Then start 10 or so threads that execute the same function. The function would grab an ip address from the queue, then do the test on the ip address and sound an alarm if necessary. The final step would be to add the ip address to the end of the queue. A Thread::Queue is thread safe, so you don't have to worry about locks or anything like that.
(This post was edited by 7stud on Mar 18, 2010, 5:05 AM)
|