Re: [G2R] Re: Various releases ...



On 9 May 2002, Michael Meeks wrote:

> Hi Havoc,
> 
> > The only difference between _exit() and exit() is that _exit() won't
> > call atexit() functions (or flush stdio buffers, but who
> > cares). Therefore unless libraries install atexit() functions, which
> > they should not do, it's fine to call exit() in apps.
> 

The only quaranteed difference between exit and _exit is that _exit won't
call atexit functions (or similar threads specific ones) and doesn't do
any processing for potential signals. 

> 	Whatever; the thing is that in this case - you open a load of
> resources, which cannot be automatically cleaned by the OS - you demand
> that no library have shutdown functions, and you demand that there are
> no atexit handlers. You can't have it both ways.
> 

The problem with libraries registering atexit() functions is that if the
library is unloaded, atexit functions from it get called (and need to get
called, or the unload needs to be blocked - languages other than C will
lose big if this doesn't happen) at that point and not program exit. It is
not always obvious when the unload happens as you can dlopen it multiple
times and it gets unloaded on the dlclose that brings the ref count to
zero. It gets worse if libraries register atexit functions that actually
reside in another library. It may well be broken implementations do
something different and broken.

It is a hidden complexity problem, but in general, there is no hard rule
that says that libraries cannot or should not install atexit functions. 

> 	Regards,
> 
> 		Michael.
> 
> -- 
>  mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot
> 

	Sander

	I see a dark sail on the horizon
	Set under a dark cloud that hides the sun
	Bring me my Broadsword and clear understanding





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]