Threading - will threads run in parallel?



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?

.



Relevant Pages

  • Cant set attribute?!
    ... and i don't understand why following exception ... def login: ... args = + args ... sock.connect(host, port) ...
    (comp.lang.python)
  • Python extension compatibility
    ... -)When I had it working un linux - I attempted to port it to Windows ... downloaded mingwin and had pexports crash when I attempted to ... -) I then attempted to create the .def by hand with no luck ... Since pycsc does not use any brand new Python functionality, ...
    (comp.lang.python)
  • Re: Webrick streaming bodies
    ... Suppose I use 'cgi.rb' and write a script for a CGI server to serve. ... serves by collecting $stdout and pushing that out its port. ... def cookPage ... contents, and this requires a big slow memory buffer, on this side, to store ...
    (comp.lang.ruby)
  • Re: Treetop parser (or PEG in general?) questions
    ... This adds the method foo to whichever alternative was taken, ... types of declarations in a language - port declarations in VHDL. ... don't want to have to create a parser for the whole VHDL language. ... def get_ports ...
    (comp.lang.ruby)
  • Re: ports/129097: [vuxml] print/hplip: document CVE-2008-2940 and CVE-2008-2941
    ... Martin Wilke asked me if I am planning to update the port. ... Please note that the handling of alerts had been changed: ... Subject: [PATCH] print/hplip: apply fixes for CVE-2008-2940 and CVE-2008-2941 ... def handle_setalerts: ...
    (FreeBSD-Security)