Deleted Added
full compact
10a11,21
> #pragma weak pthread_key_create
> #pragma weak pthread_setspecific
> #pragma weak pthread_getspecific
> #pragma weak pthread_once
> #pragma weak pthread_once
> #pragma weak pthread_cond_signal
> #pragma weak pthread_cond_wait
> #pragma weak pthread_mutex_lock
> #pragma weak pthread_mutex_unlock
>
>
291a303,312
> * We may not be linked against a full pthread implementation. If we're not,
> * then we need to fake the thread-local storage by storing 'thread-local'
> * things in a global.
> */
> static bool fakeTLS;
> /**
> * Thread-local storage for a single-threaded program.
> */
> static __cxa_thread_info singleThreadInfo;
> /**
295a317,323
> if ((0 == pthread_key_create) ||
> (0 == pthread_setspecific) ||
> (0 == pthread_getspecific))
> {
> fakeTLS = true;
> return;
> }
296a325,327
> pthread_setspecific(eh_key, (void*)0x42);
> fakeTLS = (pthread_getspecific(eh_key) != (void*)0x42);
> pthread_setspecific(eh_key, 0);
304c335,339
< pthread_once(&once_control, init_key);
---
> if ((0 == pthread_once) || pthread_once(&once_control, init_key))
> {
> fakeTLS = true;
> }
> if (fakeTLS) { return &singleThreadInfo; }
318a354
> if (fakeTLS) { return &singleThreadInfo; }
370c406,409
< pthread_mutex_lock(&emergency_malloc_lock);
---
> if (pthread_mutex_lock)
> {
> pthread_mutex_lock(&emergency_malloc_lock);
> }
381c420,423
< pthread_mutex_unlock(&emergency_malloc_lock);
---
> if (pthread_mutex_unlock)
> {
> pthread_mutex_unlock(&emergency_malloc_lock);
> }
397a440,450
> // If we don't have pthread_cond_wait, then there is only one
> // thread and it's already used all of the emergency buffers, so we
> // have no alternative but to die. Calling abort() instead of
> // terminate, because terminate can throw exceptions, which can
> // bring us back here and infinite loop.
> if (!pthread_cond_wait)
> {
> fputs("Terminating while out of memory trying to throw an exception",
> stderr);
> abort();
> }
401c454,457
< pthread_mutex_unlock(&emergency_malloc_lock);
---
> if (pthread_mutex_unlock)
> {
> pthread_mutex_unlock(&emergency_malloc_lock);
> }
434c490,493
< pthread_mutex_lock(&emergency_malloc_lock);
---
> if (pthread_mutex_lock)
> {
> pthread_mutex_lock(&emergency_malloc_lock);
> }
439,440c498,502
< pthread_cond_signal(&emergency_malloc_wait);
< pthread_mutex_unlock(&emergency_malloc_lock);
---
> if (pthread_cond_signal && pthread_mutex_unlock)
> {
> pthread_cond_signal(&emergency_malloc_wait);
> pthread_mutex_unlock(&emergency_malloc_lock);
> }