Question about atexit()

Simon Patience sp at mysteron.osf.org
Tue Aug 21 02:43:20 AEST 1990


From:  sp at mysteron.osf.org (Simon Patience)

Recently, while discussing pthreads, I mentioned the use of atexit()
as a way of helping thread cleanup if another thread calls exit().
It was pointed out to me that atexit() is not defined in 1003.1
1988.

I looked it up and sure enough it is not in the fabled list of ANSI
C interfaces on page 141 and on page 183 it says that as exit()
must do all the things _exit() does then this allows 1003.1 to
ignore the atexit() function. I have to admit that I didn't understand
that logic at all as it ignores the use of atexit() by the application
to clean up inter-process state that the kernel cannot know about
(such as data consistency in shared memory etc etc).

I originally assumed that as .1 #includes all of ANSI C then atexit()
would be able to be used in a conforming application but the book
appears to indicate otherwise.

So, can anyone in .1 explain whether atexit() really is required
by .1 or not and if not, what the rationale is because I don't
understand what the book is getting at.

  Simon Patience				Phone: (617) 621-8736
  Open Software Foundation			FAX:   (617) 225-2782
  11 Cambridge Center				Email: sp at osf.org
  Cambridge MA 02142				       uunet!osf.org!sp

Volume-Number: Volume 21, Number 44



More information about the Comp.std.unix mailing list