Advertisement
Guest User

Kevin

a guest
Apr 13th, 2010
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. servers = ["google.com", "stackoverflow.com", "yahoo.com"]
  2. results = []
  3.  
  4. def worker(server):
  5.   host = server[0]
  6.   # connect to host and such
  7.   return result
  8.  
  9. def finish(worker, result):
  10.   results.append(result)
  11.  
  12. pool = ThreadPool(1000)
  13. item = makeRequests(worker, servers, finish)
  14. [pool.putRequest(req) for req in requests]
  15. pool.wait()
  16.  
  17. # do something with results
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement