I'm running an async program, and every thread I start, I would like it
to have a timeout, that if it didn't complete the function it will just stop and kill itself(or some other thread will kill it)
func(my_item, num1, num2, num3, timeout):
calc = num1+num2
# something that takes long time(on my_item)
for item in my_list:
if item.bool:
new_thread = threading.Thread(target=func, (item, 1, 2, 3, item.timeout))
new_thread.start()
Now I want the main thread to keep on starting new threads, but I also want every thread to have a timeout to it, so that thread won't go on forever.
I'm using windows not UNIX, so I can't run SINGLRM
Thank You!