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
This commit is contained in:
parent
80e691eb7f
commit
af79ab51ec
@ -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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user