Add thread counter debugger

This commit is contained in:
Fierelier 2021-04-14 05:12:49 +02:00
parent e2c7a7f9a1
commit 7963bc56ea

View File

@ -182,11 +182,29 @@ class inThread(threading.Thread):
self.closeThread() self.closeThread()
raise raise
class debugThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
while True:
with threadsLock:
print("Threads - IN: " +str(len(inThreads)))
print("Threads - OUT: " +str(len(outThreads)))
time.sleep(10)
def main(): def main():
global threadId global threadId
serverSocket.bind(serverAddr) serverSocket.bind(serverAddr)
serverSocket.listen(1024) serverSocket.listen(1024)
# DEBUG
global time
import time
debug = debugThread()
debug.start()
# DEBUG END
while True: while True:
connection, address = serverSocket.accept() connection, address = serverSocket.accept()
connection.settimeout(15) connection.settimeout(15)