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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -