I am struggling with multi threading my code. I want to ALWAYS have 10 active threads, but I am not sure how. Current code:
import threading from random import randint import os import names import random import time threads = 10 def f(): print("my actual function is 200+ lines") return for i in range(threads): t = threading.Thread(target=f) t.start()
My current code starts 10 threads, but does not maintain them, keep active. Thank you for the help
edit: have also tried with while True
, but no luck.
没有评论:
发表评论