WARNING: This page is archived and not updated. Please bear in mind any information may be incorrect and any code may not work. Use at your own risk.
James Gardner: Home > Blog > 2008 > Empty Threading Example

Empty Threading Example

Posted:2008-06-16 17:30
Tags:Python

I don't have anywhere good to put this skeleton of threading code so it is going here!

from threading import Thread

class Thread1(Thread):
   def __init__ (self):
      Thread.__init__(self)

   def run(self):
      pass

class Thread2(Thread):
   def __init__ (self):
      Thread.__init__(self)

   def run(self):
       pass

t1 = Thread1()
t1.start()
t2 = Thread2()
t2.start()

# Both threads run at the same time until they finish or
# this code is called

t1.join()
t2.join()

(view source)

James Gardner: Home > Blog > 2008 > Empty Threading Example