Re: [HACKERS] atexit vs. on_exit

2011-12-22 Thread Tom Lane
Peter Eisentraut  writes:
> Are there any supported platforms that have only on_exit() but not
> atexit()?

Trolling the git logs shows that configure's support for on_exit was
added here:

commit df247b821d811abcfc0ac707e1a3af9dfce474c9
Author: Tatsuo Ishii 
Date:   Tue Feb 27 08:13:31 2001 +

Massive commits for SunOS4 port.

SunOS4 is definitely pretty dead.  According to the info I have,
atexit() is required by ANSI C (that would be C89 not C99), so it
certainly seems unlikely that we'd ever see platforms without it
anymore.

A slightly different issue is that atexit is less functional than
on_exit (the former does not tell the callbacks the exit() code).
There is one place in our code where it would be nice to have that.
But since we're preferring atexit where available, we seem to be
getting along fine without it anyway.

+1 for simplifying.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] atexit vs. on_exit

2011-12-22 Thread Peter Eisentraut
Are there any supported platforms that have only on_exit() but not
atexit()?

It would be good in some cases to rewrite custom arrangements such as
exit_nicely() or die_horribly() using those exit hooks, but supporting
both through ifdefs makes the code more ugly than before.  I dug around
the buildfarm logs and documentation around the internet, and it appears
that all non-ancient platforms support atexit().  The use of on_exit()
in PostgreSQL source code appears to come from the original Postgres95
code.

I would like to get rid of on_exit().  Alternatively, atexit() could be
implemented in libpgport as a wrapper around on_exit().



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers