python - How to replace a thread when finished -
i have code:
from threading import thread queue = [] x in range(5): queue.append(thread(target=somefunction)) queue[x].start() while true: x in range(5): if not queue[x].isalive(): queue[x] = thread(target=someotherfunction) queue[x].start() #for reason, code not work , #iterates through loop lot
i thinking of adding queue, saw in docs, don't think it's suited want. do want replace thread in list if has finished. if not, not replace it.
just reminder, pseudo code.
this code suited multi-segment downloader.
as sidenote, python 3.
Comments
Post a Comment