No threading.start_new_thread(), useful addition?
Christian Heimes
lists at cheimes.de
Thu Oct 8 11:35:57 EDT 2009
Ulrich Eckhardt wrote:
> No, as this one doesn't give me a handle to the thread. I also find this
> barely readable, for sure it doesn't beat the readability of the proposed
> function.
Roll your own convenient function, though. :) At work we have this short
function in our tool box:
def daemonthread(target, name=None, autostart=True, args=(), kwargs=None):
"""Start a thread as daemonic thread
"""
thread = Thread(target=target, name=name, args=args, kwargs=kwargs)
thread.setDaemon(True)
if autostart:
thread.start()
return thread
Christian
More information about the Python-list
mailing list