Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import thread
- from time import sleep
- def Thread1(threadName, delay):
- x = 100
- print("Threads started...\n")
- while True:
- x -= 1
- if x >= 0:
- sleep(1)
- print("Thread1[" + str(x) +"]\n")
- else:
- sleep(1)
- print("Thread1 - Done")
- break
- def Thread2(threadName, delay):
- y = 0
- sleep(3)
- while True:
- y += 1
- if y <= 100:
- sleep(1)
- print("Thread2[" + str(y) + "]\n")
- else:
- sleep(1)
- print("Thread2 - Done")
- break
- print("Starting up Threads...")
- sleep(1)
- thread.start_new_thread( Thread1, ("Thread-1", 1) )
- thread.start_new_thread( Thread2, ("Thread-2", 1) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement