Question about thread

Valkyrie valkyrie at cuhk.edu.hk
Fri Nov 19 15:50:17 CET 2004


To be more precise, what I want to do is to have a threaded program to handle
some jobs concurrently (while those jobs are fetching  information from the
Internet, so threading could speed up the process if the network is slow)

            start
              | (blahblahblah...)
              v
  +-----+-----+-----+-----+
  |     |     |     |     |
--+-- --+-- --+-- --+-- --+--
|   | |   | |   | |   | |   |
| A | | B | | C | | D | | E |
|   | |   | |   | |   | |   |
--+-- --+-- --+-- --+-- --+--
  |     |     |     |     |
  +-----+-----+-----+-----+
              | (blahblahblah...)
              v
           finish!

While process A-E will access the shared variables within the same program, and
each of those processes will have to parse a document on its own.


Valkyrie wrote:
> Refering to the following codes I found, there is nothing displayed in the
> console, may I ask why?
> 
> def thrd(param): # the thread worker function
>     print "Received",param
> 
> import thread
> for i in range(5): # start five threads passing i to each one
>     thread.start_new_thread(thrd,(i,))
> 
> Thanks in advance



More information about the Python-list mailing list