Re: Thread locking question.

2009-05-09 Thread MRAB
Piet van Oostrum wrote: grocery_stocker (gs) wrote: gs> The following code gets data from 5 different websites at the "same gs> time". [snip] gs> start = time.time() gs> def main(): gs> for i in range(5): gs> t = MyUrl(queue) gs> t.setDaemon(True) gs> t.star

Re: Thread locking question.

2009-05-09 Thread Piet van Oostrum
> grocery_stocker (gs) wrote: [snip] >gs> Maybe I'm being a bit daft, but what prevents the data from www.yahoo.com >gs> from being mixed up with the data from www.google.com? Doesn't using >gs> queue() prevent the data from being mixed up? Nothing in your script prevents the data from gett

Re: Thread locking question.

2009-05-09 Thread Pascal Chambon
grocery_stocker a écrit : On May 9, 8:36 am, Piet van Oostrum wrote: grocery_stocker (gs) wrote: gs> The following code gets data from 5 different websites at the "same gs> time". gs> #!/usr/bin/python gs> import Queue gs> import threading gs> import urllib2 gs> import time

Re: Thread locking question.

2009-05-09 Thread grocery_stocker
On May 9, 8:36 am, Piet van Oostrum wrote: > > grocery_stocker (gs) wrote: > >gs> The following code gets data from 5 different websites at the "same > >gs> time". > >gs> #!/usr/bin/python > >gs> import Queue > >gs> import threading > >gs> import urllib2 > >gs> import time > >gs> hosts = ["ht

Re: Thread locking question.

2009-05-09 Thread Piet van Oostrum
> grocery_stocker (gs) wrote: >gs> The following code gets data from 5 different websites at the "same >gs> time". >gs> #!/usr/bin/python >gs> import Queue >gs> import threading >gs> import urllib2 >gs> import time >gs> hosts = ["http://yahoo.com";, "http://google.com";, "http://amazon.com

Thread locking question.

2009-05-09 Thread grocery_stocker
The following code gets data from 5 different websites at the "same time". #!/usr/bin/python import Queue import threading import urllib2 import time hosts = ["http://yahoo.com";, "http://google.com";, "http://amazon.com";, "http://ibm.com";, "http://apple.com";] queue = Queue.Queue()