unload_library(): Added comment about the exit hook handling.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39299 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-11-04 16:22:11 +00:00
parent 85f9496a24
commit d64f6189c0
1 changed files with 12 additions and 1 deletions

View File

@ -612,7 +612,18 @@ unload_library(void* handle, image_id imageID, bool addOn)
if (status == B_OK) {
while ((image = get_disposable_images().head) != NULL) {
// call image fini here...
// Call the exit hooks that live in this image.
// Note: With the Itanium ABI this shouldn't really be done this
// way anymore, since global destructors are registered via
// __cxa_atexit() (the ones that are registered dynamically) and the
// termination routine should call __cxa_finalize() for the image.
// The reason why we still do it is that hooks registered with
// atexit() aren't associated with the image. We could find out
// there which image the hooks lives in and register it
// respectively, but since that would be done always, that's
// probably more expensive than calling
// call_atexit_hooks_for_range() only here, which happens only when
// libraries are unloaded dynamically.
if (gRuntimeLoader.call_atexit_hooks_for_range) {
gRuntimeLoader.call_atexit_hooks_for_range(
image->regions[0].vmstart, image->regions[0].vmsize);