Some questions about atexit

Discussion in 'Python' started by Roy Smith, Sep 13, 2012.

  1. Roy Smith

    Roy Smith Guest

    The atexit docs (http://docs.python.org/library/atexit.html) are very
    confusing. In one place they say, "The order in which the functions are
    called is not defined". In another place, "all functions registered are
    called in last in, first out order". Which is correct?

    Also, it's not clear how atexit handlers interact with threading. Do
    all handlers get called in the main thread? What if some other thread
    registers a handler? Does it get called in that thread?
    Roy Smith, Sep 13, 2012
    #1
    1. Advertising

  2. Roy Smith

    Terry Reedy Guest

    On 9/12/2012 8:58 PM, Roy Smith wrote:
    > The atexit docs (http://docs.python.org/library/atexit.html) are very
    > confusing. In one place they say, "The order in which the functions are
    > called is not defined". In another place, "all functions registered are
    > called in last in, first out order". Which is correct?


    Check the tracker (bugs.python.org) for atexit issues, open and closed.
    I believe there was one about order and whether to make a guarantee. The
    doc might have been changed one place and not another. The newer
    statement is probably correct. In any case, the wrong place should be
    corrected.

    > Also, it's not clear how atexit handlers interact with threading. Do
    > all handlers get called in the main thread? What if some other thread
    > registers a handler? Does it get called in that thread?


    Don't know about this.

    --
    Terry Jan Reedy
    Terry Reedy, Sep 13, 2012
    #2
    1. Advertising

  3. Roy Smith

    Roy Smith Guest

    In article <>,
    Terry Reedy <> wrote:

    > On 9/12/2012 8:58 PM, Roy Smith wrote:
    > > The atexit docs (http://docs.python.org/library/atexit.html) are very
    > > confusing. In one place they say, "The order in which the functions are
    > > called is not defined". In another place, "all functions registered are
    > > called in last in, first out order". Which is correct?

    >
    > Check the tracker (bugs.python.org) for atexit issues, open and closed.


    Thanks for the pointer. The operative one seems to be
    http://bugs.python.org/issue15233
    Roy Smith, Sep 13, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Serve Laurijssen

    atexit and global destructors

    Serve Laurijssen, Jan 15, 2004, in forum: C++
    Replies:
    3
    Views:
    6,953
    tom_usenet
    Jan 15, 2004
  2. JKop
    Replies:
    8
    Views:
    448
  3. Bengt Richter
    Replies:
    0
    Views:
    280
    Bengt Richter
    Aug 25, 2004
  4. Chris Gorton

    atexit not being executed

    Chris Gorton, May 3, 2005, in forum: Python
    Replies:
    0
    Views:
    387
    Chris Gorton
    May 3, 2005
  5. MathWizard

    atexit problems and questions....

    MathWizard, Jul 27, 2007, in forum: C++
    Replies:
    9
    Views:
    621
    MathWizard
    Jul 29, 2007
Loading...

Share This Page