Home Blog CV Projects Patterns Notes Book Colophon Search

Empty Threading Example

16 Jun, 2008

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()

Copyright James Gardner 1996-2020 All Rights Reserved. Admin.