summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorpooka <pooka@NetBSD.org>2009-10-08 16:33:45 +0000
committerpooka <pooka@NetBSD.org>2009-10-08 16:33:45 +0000
commit50efcfca57d6f742b7e0b5033fd2669e9d30ffb4 (patch)
treec7b4b29c199a19a56c6dd3414acb86dc0785f35a /lib/libc/stdlib
parent3ae0a1fe800bbb5ad0943aacaa95a11c0309d8b2 (diff)
When converting the locking path of mutex+counter to a real recursive
mutex, it's a good idea to convert the unlock path too so that the recursive mutex gets released as many times as it was locked. Fixes pthread + cxa deadlock.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/atexit.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c
index d779727797f..695f0ce46ed 100644
--- a/lib/libc/stdlib/atexit.c
+++ b/lib/libc/stdlib/atexit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: atexit.c,v 1.23 2008/04/28 20:23:00 martin Exp $ */
+/* $NetBSD: atexit.c,v 1.24 2009/10/08 16:33:45 pooka Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: atexit.c,v 1.23 2008/04/28 20:23:00 martin Exp $");
+__RCSID("$NetBSD: atexit.c,v 1.24 2009/10/08 16:33:45 pooka Exp $");
#endif /* LIBC_SCCS and not lint */
#include "reentrant.h"
@@ -219,14 +219,12 @@ again:
} else
prevp = &ah->ah_next;
}
-
call_depth--;
+ mutex_unlock(&atexit_mutex);
if (call_depth > 0)
return;
- mutex_unlock(&atexit_mutex);
-
/*
* Now free any dead handlers. Do this even if we're about to
* exit, in case a leak-detecting malloc is being used.