threading.Thread Need help
Posted: Wed Dec 21, 2016 10:14 pm
Hi all.
Sorry for my English. I have a problem with the module threading.
When I use two threads, the CPU load increases significantly >50%. I usually have <2% when using FreePie without thread.
I have very little programming experience, so have absolutely no idea how to solve this problem.
Here is a sample code that I use:
any help
thank you in advance
Sorry for my English. I have a problem with the module threading.
When I use two threads, the CPU load increases significantly >50%. I usually have <2% when using FreePie without thread.
I have very little programming experience, so have absolutely no idea how to solve this problem.
Here is a sample code that I use:
Code: Select all
import threading
def myThtead():
while True:
if keyboard.getKeyDown(Key.Q):
break
if starting:
myThread_1=threading.Thread(target=myThtead,args=())
myThread_2=threading.Thread(target=myThtead,args=())
myThread_1.start()
myThread_2.start()
diagnostics.watch(threading.activeCount())
thank you in advance