Reputation: 1
I'm currently on phone and can't get the full code. It' based on pygame. But its something like this:
def func():
#Bunch of for loops that needs 0.2 secs
#Main loop
while True:
clock.tick(60)
thr=Thread(target=func)
thr. start()
#Here it draws frames(it should be 60 per second, but because of threads, it's only 5)
These threads reduce frame rate.(They lag the main loop) I know that the clock.tick(60) isn't problem here. Should I create thread for this while loop?
Upvotes: 0
Views: 359
Reputation: 1445
Why are you spawning threads like no tomorrow in the while True
loop?
I don't think there exists one case where this could be beneficial to your program.
I would strongly advise to manage carefully the number of your threads in your program and joining them if they are not daemon
.
Upvotes: 0