[Tutor] Thread deamon
kent37 at tds.net
Mon Aug 22 15:40:42 CEST 2005
Jorge Louis de Castro wrote:
> Are these two equivalent:
> def run_server(socket):
> thread = Thread(target=run_server, args=(server,))
They both start threads but the threading module also modifies the behavior of sys.exit() so the program will not exit until all *non* daemon threads exit. So you may get the behaviour you want with 1) as written (without the setDaemon() call). Calling setDaemon(True) *allows* the program to exit before the daemon thread terminates which sounds like the opposite of what you want.
> So that I can uncomment the setDaemon() method?
> Tutor maillist - Tutor at python.org
More information about the Tutor