Re: threads and sys.exit()

2006-04-24 Thread robert
robert wrote: > killing hard (SIGKILL etc ) is low level. it should be OS-specific, as > Python should not make itself inconsistent (and os._exit() is that at mid-low level ; better not to say; no finalizations etc.) -robert -- http://mail.python.org/mailman/listinfo/python-list

Re: threads and sys.exit()

2006-04-24 Thread robert
gangesmaster wrote: > that's not a question of design. i just want a child-thread to kill the > process. in a platform agnostic way. > the clean kill is the 'KeyboardInterrupt'. your code finalizations are at least done corretly. thats also raised on SIGINT by default. so thread.interrupt_main

Re: threads and sys.exit()

2006-04-24 Thread gangesmaster
that's not a question of design. i just want a child-thread to kill the process. in a platform agnostic way. -- http://mail.python.org/mailman/listinfo/python-list

Re: threads and sys.exit()

2006-04-24 Thread gangesmaster
i can't make the main thread daemonic. the situation is this: * the main thread starts a thread * the new thread does sys.exit() * the new thread dies, but the process remains i can do os.kill(os.getpid()), or TerminateProcess(-1) but that's not what i want -tomer -- http://mail.python.org/mail

Re: threads and sys.exit()

2006-04-24 Thread robert
gangesmaster wrote: > calling sys.exit() from a thread does nothing... the thread dies, but > the interpreter remains. i guess the interpreter just catches and > ignore the SystemExit exception... > > does anybody know of a way to overcome this limitation? > call thread.interrupt_main() on *

Re: threads and sys.exit()

2006-04-24 Thread Rene Pijlman
gangesmaster: >(i forgot to say it didn't work) It's the remaining threads that need to be daemon, when some thread performs sys.exit. When no non-daemon thread remains, the application terminates. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: threads and sys.exit()

2006-04-24 Thread gangesmaster
(i forgot to say it didn't work) -- http://mail.python.org/mailman/listinfo/python-list

Re: threads and sys.exit()

2006-04-24 Thread gangesmaster
>>> import threading >>> t=threading.Thread(target=sys.exit) >>> t.setDaemon(True) >>> t.start() >>> ? -- http://mail.python.org/mailman/listinfo/python-list

Re: threads and sys.exit()

2006-04-24 Thread Diez B. Roggisch
gangesmaster wrote: > calling sys.exit() from a thread does nothing... the thread dies, but > the interpreter remains. i guess the interpreter just catches and > ignore the SystemExit exception... > > does anybody know of a way to overcome this limitation? Use Thread.setDaemon(True) on your thre

threads and sys.exit()

2006-04-24 Thread gangesmaster
calling sys.exit() from a thread does nothing... the thread dies, but the interpreter remains. i guess the interpreter just catches and ignore the SystemExit exception... does anybody know of a way to overcome this limitation? -tomer -- http://mail.python.org/mailman/listinfo/python-list