summaryrefslogtreecommitdiff
path: root/lib/libpthread/pthread_specific.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2012-11-21 19:19:24 +0000
committerchristos <christos@NetBSD.org>2012-11-21 19:19:24 +0000
commitc15b1d2227e357155ff2d8b95e5f7a06a1e817ea (patch)
tree73d3c1dbf442dd19f8e677b6c325cbf61162681f /lib/libpthread/pthread_specific.c
parent144164ce8bf9c13ac2fc353932a9427d8e11848f (diff)
Replace the simple implementation of pthread_key_{create,destroy}
and pthread_{g,s}etspecific functions, to one that invalidates values of keys in other threads when pthread_key_delete() is called. This fixes chromium, which expects pthread_key_delete() to do cleanup in all threads.
Diffstat (limited to 'lib/libpthread/pthread_specific.c')
-rw-r--r--lib/libpthread/pthread_specific.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/libpthread/pthread_specific.c b/lib/libpthread/pthread_specific.c
index 7e0fbd46391..17c5db25f69 100644
--- a/lib/libpthread/pthread_specific.c
+++ b/lib/libpthread/pthread_specific.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_specific.c,v 1.23 2012/09/12 14:55:48 matt Exp $ */
+/* $NetBSD: pthread_specific.c,v 1.24 2012/11/21 19:19:24 christos Exp $ */
/*-
* Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_specific.c,v 1.23 2012/09/12 14:55:48 matt Exp $");
+__RCSID("$NetBSD: pthread_specific.c,v 1.24 2012/11/21 19:19:24 christos Exp $");
/* Functions and structures dealing with thread-specific data */
@@ -62,18 +62,14 @@ pthread_setspecific(pthread_key_t key, const void *value)
* and return it from functions that are const void *, without
* generating a warning.
*/
- /*LINTED const cast*/
- self->pt_specific[key] = (void *) value;
- self->pt_havespecific = 1;
-
- return 0;
+ return pthread__add_specific(self, key, value);
}
void *
pthread_getspecific(pthread_key_t key)
{
- return pthread__self()->pt_specific[key];
+ return pthread__self()->pt_specific[key].pts_value;
}
unsigned int