[New-bugs-announce] [issue5962] Ambiguity about the semantics of sys.exit() and os._exit() in multithreaded program

Pascal Chambon report at bugs.python.org
Thu May 7 20:53:15 CEST 2009


New submission from Pascal Chambon <chambon.pascal at gmail.com>:

Hello

I once was rather confused, because nothing in the sys and os modules
mentionned the behaviours that the exit() and _exit() functions were
supposed to have when called inside a non-main thread.
I've eventually found in multithreading-related docs that sys.exit()
made only the calling thread exit (without affecting the other threads
and the application), and I've eventually guessed that on the other
side, os._exit() always terminated the application wthout caring about
other threads or open files etc.
But I don't know if this will always be the case, or if using other
threading libraries than the standard one might change this semantics.

And concerning return code, I've found nothing indicating what happened
when different threads returned different codes. My experiments show
that only the main thread's return code is taken into account, but maybe
it's platform dependent (I'm on windows vista) ? 

So well, maybe we should add in the doc of sys and os some comments
about multithreading and returning codes, even if it is to say that
those are implementation details or platform dependant B-)

Regards, 
pascal

----------
assignee: georg.brandl
components: Documentation
messages: 87389
nosy: georg.brandl, pakal
severity: normal
status: open
title: Ambiguity about the semantics of sys.exit() and os._exit() in multithreaded program
type: feature request
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5962>
_______________________________________


More information about the New-bugs-announce mailing list