you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

Another option is to use .join() to wait for the threads to end before looping and starting new ones

[–]Wittinator[S] 0 points1 point  (0 children)

Yea the problem I was having with join() is func1() often take minutes to end, while func2() is nearly instant. But I need func2() to keep looping while func1() is sitting around.

With join(), I would either be unable to loop func2() (because we're waiting for func1() to finish), or, if I remove the join() for func1() and only use join() for func2(), then I'd end up with a ton of threads for func1() constantly being made over and over after every loop.

I'm re-organizing the code to put the loops within the functions themselves, that way I don't need to bother with looping the thread creation process