From 8e5aaad9daee699404f00c79100dfd88781eedf5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 7 Jul 2004 07:41:02 +0000 Subject: Update. 2004-07-07 Ulrich Drepper * elf/dl-fini.c (_dl_fini): Move the unlock of the ld.so lock before the loop running the destructors. --- elf/dl-fini.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'elf') diff --git a/elf/dl-fini.c b/elf/dl-fini.c index c34ee8ea1e..ca1cb8c476 100644 --- a/elf/dl-fini.c +++ b/elf/dl-fini.c @@ -126,6 +126,14 @@ _dl_fini (void) } } + /* We do not rely on the linked list of loaded object anymore from + this point on. We have our own list here (maps). The various + members of this list cannot vanish since the open count is too + high and will be decremented in this loop. So we release the + lock so that some code which might be called from a destructor + can directly or indirectly access the lock. */ + __rtld_lock_unlock_recursive (GL(dl_load_lock)); + /* 'maps' now contains the objects in the right order. Now call the destructors. We have to process this array from the front. */ for (i = 0; i < GL(dl_nloaded); ++i) @@ -171,8 +179,6 @@ _dl_fini (void) --l->l_opencount; } - __rtld_lock_unlock_recursive (GL(dl_load_lock)); - if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0)) _dl_debug_printf ("\nruntime linker statistics:\n" " final number of relocations: %lu\n" -- cgit 1.4.1