summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorxtraeme <xtraeme@NetBSD.org>2008-02-25 14:35:54 +0000
committerxtraeme <xtraeme@NetBSD.org>2008-02-25 14:35:54 +0000
commitc3e906d7a0d7df7b75ff9cf6d0c33e39aeb29a96 (patch)
treecdc09e1993c0ceb6784ac01676a926ad714547da /lib/libc/stdlib
parent1b5143aa5daee4a8a5d33379dcd3776e81a8fe40 (diff)
There's no need to do the mutex_trylock dance anymore in __cxa_finalize(),
just using mutex_lock() is enough.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/atexit.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c
index cd8eea4e7fa..72526d16b0b 100644
--- a/lib/libc/stdlib/atexit.c
+++ b/lib/libc/stdlib/atexit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: atexit.c,v 1.21 2008/02/25 14:15:10 xtraeme Exp $ */
+/* $NetBSD: atexit.c,v 1.22 2008/02/25 14:35:54 xtraeme Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: atexit.c,v 1.21 2008/02/25 14:15:10 xtraeme Exp $");
+__RCSID("$NetBSD: atexit.c,v 1.22 2008/02/25 14:35:54 xtraeme Exp $");
#endif /* LIBC_SCCS and not lint */
#include "reentrant.h"
@@ -177,24 +177,12 @@ __cxa_atexit(void (*func)(void *), void *arg, void *dso)
void
__cxa_finalize(void *dso)
{
- static thr_t owner;
static u_int call_depth;
struct atexit_handler *ah, *dead_handlers = NULL, **prevp;
void (*cxa_func)(void *);
void (*atexit_func)(void);
- /*
- * We implement our own recursive mutex here because we need
- * to keep track of the call depth anyway, and it saves us
- * having to dynamically initialize the mutex.
- */
- if (mutex_trylock(&atexit_mutex) == 0)
- owner = thr_self();
- else if (owner != thr_self()) {
- mutex_lock(&atexit_mutex);
- owner = thr_self();
- }
-
+ mutex_lock(&atexit_mutex);
call_depth++;
/*