﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
218	Endless loop in atexit.c after loading a DLL	dmik	bird	"Here is what happens:

 1. An application declares a local static object inside the function.
 2. When the function is called for the first time, the constructor of this object is called which loads a DLL with DosLoadModule().
 3. After calling the object's constructor, C++ runtime tries to add its destructor to the atexit list with _std_atexit().
 4. _std_atexit() calls __libc_atexit_new() which spins indefinitely in its for() loop.

Note that this happens to the debug build of /branches/libc-0.6, haven't tried the release build so far.

Also note that if I remove the DLL that is being loaded (so that it cannot be found and DosLoadModule() fails) the problem doesn't show up. As an assumption, the loaded DLL (which is also kLIBC-based) messes up the atexit list somehow when it adds its static destructors in DLL_InitTerm().

Another observation is that an attempt to exit the spin by pressing Ctrl-C causes a similar spin to happen in the for loop of the __libc_atexit_unload() function."	defect	assigned	normal		libc	0.6	normal		atexit	
