Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # http://stackoverflow.com/questions/23100704/running-infinite-loops-using-threads-in-python
- from threading import Thread
- def runA():
- while True:
- print 'A\n'
- def runB():
- while True:
- print 'B\n'
- if __name__ == "__main__":
- t1 = Thread(target = runA)
- t2 = Thread(target = runB)
- t1.setDaemon(True)
- t2.setDaemon(True)
- t1.start()
- t2.start()
- while True:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement