Threading - will threads run in parallel?

SolaFide solafidefarms at gmail.com
Tue Feb 28 14:20:05 EST 2006


I have 2 threads that I want to run at the same time: for instance:

from threading import Thread

class test(Thread):
         def run(self):
                  while True:
                          get(asdf)

class test2(Thread):
           def run(self):
                 while True:
                          get(jkl)
ack=test()
jkl=test2()
ack.start()
jkl.start()

(get() is a function which waits for a ping on a specific port, thus
stopping the program for a while.)

Will these run together, or do I have to find some other way of running
in parallel?

Also, is it possible to split off a program for the terminal that
started it? As in I type in python test.py and test.py runs in the
background and lets me do other things in that terminal?




More information about the Python-list mailing list