Email List: Xaustin-group-lX
[All Lists]

Re: whether ext() and atexit() are safe w.r.t each other

To: Anoop <acv@xxxxxxxxxxxxxxxxxx>
Subject: Re: whether ext() and atexit() are safe w.r.t each other
From: Eric Blake <ebb9@xxxxxxx>
Date: Fri, 06 Jun 2008 06:22:01 -0600
Cc: austin-group-l@xxxxxxxxxxxxx
References: <48491601.7030306@linux.vnet.ibm.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Anoop on 6/6/2008 4:48 AM:
| Being more specific, if a thread is registering a handler using atexit()
| while
| exit() is processing the already registered handlers in the main thread,
| what is the expected behavior as per the standard?

The standard is clear (and requires the same as C99): "At normal program
termination, all functions registered by the atexit() function shall be
called, in the reverse order of their registration, except that a function
is called after any previously registered functions that had already been
called at the time it was registered."

So if an additional atexit() function is registered during exit()
processing, that newly-registered handler will be the next handler
executed when the current handler completes.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhJK+kACgkQ84KuGfSFAYDyBACgi2bUOOVhuJVsqP1UStJv4oFv
td0AmwbzjgXp59cxACepMTBHCFH7MniE
=2D/D
-----END PGP SIGNATURE-----

<Prev in Thread] Current Thread [Next in Thread>