Initial code commit

This commit is contained in:
Lexi / Zoe 2021-12-28 22:10:27 +01:00
parent c9eba67347
commit 167847cd28
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
5 changed files with 138 additions and 0 deletions

26
src/main.py Normal file
View file

@ -0,0 +1,26 @@
# main.py -- run after boot.py
import _thread
import time
def count(name: str, stop: int = 10):
i = 0
while True:
print("[{}] {}".format(name, i))
i += 1
if i > stop:
break
time.sleep(1)
print("[{}] exit".format(name))
# Start some threads
_thread.start_new_thread(count, ('thread1', 5))
_thread.start_new_thread(count, ('thread2', 3))
# Main thread
count('main', 10)