multithreading - When is a thread's run command terminated in Python -


in reading this

once thread’s activity started, thread considered ‘alive’. stops being alive when run() method terminates – either normally, or raising unhandled exception.

and these answers, still not sure when python thread "dies". if, example invoke thread this:

def preparemessage():     print('test')  def notify(message):     thread = threading.thread(target=preparemessage, args=(message))     thread.start() 

would thread terminate after printing "test"?

i.e. these threads terminate when things responsible finish? realize not great way of explaining things don't know how else it. there simple way explain this?

yes. once target function has finished executing or error has occurred thread terminated.


Comments