diff options
author | Marius Strobl <marius@FreeBSD.org> | 2007-11-06 21:50:43 +0000 |
---|---|---|
committer | Marius Strobl <marius@FreeBSD.org> | 2007-11-06 21:50:43 +0000 |
commit | 9a2706abccb38fac1568081606259d81b6b441a7 (patch) | |
tree | 67875d8c228cb7d69e0b0efa33ea6b2dae9071ff /lib/libthr/thread/thr_spec.c | |
parent | ee8f97394e88baec0a6882e37564225db49d1fdf (diff) | |
download | src-9a2706abccb38fac1568081606259d81b6b441a7.tar.gz src-9a2706abccb38fac1568081606259d81b6b441a7.zip |
In _pthread_key_create() ensure that libthr is initialized. This
fixes a NULL-dereference of curthread when libstdc+ initializes
the exception handling globals on archs we can't use GNU TLS due
to lack of support in binutils 2.15 (i.e. arm and sparc64), yet,
thus making threaded C++ programs compiled with GCC 4.2.1 work
again on these archs.
Reviewed by: davidxu
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=173394
Diffstat (limited to 'lib/libthr/thread/thr_spec.c')
-rw-r--r-- | lib/libthr/thread/thr_spec.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_spec.c b/lib/libthr/thread/thr_spec.c index 36e74f29c618..06d128704f5f 100644 --- a/lib/libthr/thread/thr_spec.c +++ b/lib/libthr/thread/thr_spec.c @@ -51,9 +51,13 @@ __weak_reference(_pthread_setspecific, pthread_setspecific); int _pthread_key_create(pthread_key_t *key, void (*destructor) (void *)) { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; int i; + _thr_check_init(); + + curthread = _get_curthread(); + /* Lock the key table: */ THR_LOCK_ACQUIRE(curthread, &_keytable_lock); for (i = 0; i < PTHREAD_KEYS_MAX; i++) { |