Advertisement
adnan360

Threading with class.py

Jan 5th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. from threading import Thread
  2.  
  3. class myClassA(Thread):
  4.     def __init__(self):
  5.         Thread.__init__(self)
  6.         self.daemon = True
  7.         self.start()
  8.     def run(self):
  9.         while True:
  10.             print 'A'
  11.  
  12. class myClassB(Thread):
  13.     def __init__(self):
  14.         Thread.__init__(self)
  15.         self.daemon = True
  16.         self.start()
  17.     def run(self):
  18.         while True:
  19.             print 'B'
  20.  
  21.  
  22. myClassA()
  23. myClassB()
  24. while True:
  25.     pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement