Add Uptated-Prototype/Threading-test.py
This commit is contained in:
27
Uptated-Prototype/Threading-test.py
Normal file
27
Uptated-Prototype/Threading-test.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
|
codedone = False
|
||||||
|
|
||||||
|
def TestThreadOne():
|
||||||
|
input("Press Enter to Quit?\n")
|
||||||
|
codedone = True
|
||||||
|
|
||||||
|
def TestThreadTwo():
|
||||||
|
testcounter = 0
|
||||||
|
while not codedone:
|
||||||
|
time.sleep(1)
|
||||||
|
testcounter += 1
|
||||||
|
print(testcounter)
|
||||||
|
if testcounter >= 30
|
||||||
|
break
|
||||||
|
|
||||||
|
t1 = threading.Thread(target=TestThreadOne, daemon=False)
|
||||||
|
t2 = threading.Thread(target=TestThreadTwo, daemon=True)
|
||||||
|
|
||||||
|
t1.start()
|
||||||
|
t2.start()
|
||||||
|
# t1.join()
|
||||||
|
# t2.join()
|
||||||
|
|
||||||
|
print("Done!")
|
||||||
Reference in New Issue
Block a user