Add Uptated-Prototype/Threading-test.py

This commit is contained in:
2025-11-16 18:06:34 -08:00
parent 0a8b35c3ca
commit d39e867b3e

View 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!")