Question about thread
Valkyrie
valkyrie at cuhk.edu.hk
Fri Nov 19 10:45:21 EST 2004
More information about the Python-list mailing list
Fri Nov 19 10:45:21 EST 2004
- Previous message (by thread): Question about thread
- Next message (by thread): Question about thread
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
When I do it line by line in python's console, I have similar result to youl. But when I try to run it in a file, say: python demo.py It just returns me nothing. I have no idea on this right now... Russell Blau wrote: > "Valkyrie" <valkyrie at cuhk.edu.hk> wrote in message > news:1100875373.911763 at eng-ser6... > >>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,)) > > > You may ask, but when I tried your code, here is what happened: > > Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>>>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,)) > ... > 1960 > 836 > 232 > 2864 > 3692 > >>>>Received 0 > > Received 1 > Received 2 > Received 3 > Received 4 > > Note that the numbers 1960, etc., appear to be the return values of the > thread.start_new_thread() function. > >
- Previous message (by thread): Question about thread
- Next message (by thread): Question about thread
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list