atexit + threads = bug?

skip at pobox.com skip at pobox.com
Thu Jan 12 14:23:31 EST 2006


    David> atExitFunc is called when the main thread terminates, rather than
    David> when the process exits.  The atexit documentation contains
    David> several warnings, but nothing about this.  Is this a bug?

This might be a bug, but I can't see how it can be in atexit.  Atexit just
registers its own sys.exitfunc function, then when it's called, calls all
the individual exit functions that have been registered with it.  It has no
control over when sys.exitfunc is invoked.  sys.exitfunc is called as the
first action of Py_Finalize.  It appears that Py_Finalize is called when the
main thread exits.

Skip



More information about the Python-list mailing list