am b78aa539: am bf397b60: am 21372896: Merge "fix __cxa_finalize() implementation to be thread safe."

* commit 'b78aa5390492cfe288d0128b749b18d2c740635e':
  fix __cxa_finalize() implementation to be thread safe.
This commit is contained in:
Elliott Hughes 2012-07-31 10:41:40 -07:00 committed by Android Git Automerger
commit ad2e065de1

View File

@ -131,6 +131,7 @@ __cxa_finalize(void *dso)
if (__atexit_invalid) if (__atexit_invalid)
return; return;
_ATEXIT_LOCK();
call_depth++; call_depth++;
for (p = __atexit; p != NULL; p = p->next) { for (p = __atexit; p != NULL; p = p->next) {
@ -149,6 +150,7 @@ __cxa_finalize(void *dso)
p->fns[n].fn_ptr.cxa_func = NULL; p->fns[n].fn_ptr.cxa_func = NULL;
mprotect(p, pgsize, PROT_READ); mprotect(p, pgsize, PROT_READ);
} }
_ATEXIT_UNLOCK();
#if ANDROID #if ANDROID
/* it looks like we should always call the function /* it looks like we should always call the function
* with an argument, even if dso is not NULL. Otherwise * with an argument, even if dso is not NULL. Otherwise
@ -162,6 +164,7 @@ __cxa_finalize(void *dso)
else else
(*fn.fn_ptr.std_func)(); (*fn.fn_ptr.std_func)();
#endif /* !ANDROID */ #endif /* !ANDROID */
_ATEXIT_LOCK();
} }
} }
@ -178,6 +181,7 @@ __cxa_finalize(void *dso)
} }
__atexit = NULL; __atexit = NULL;
} }
_ATEXIT_UNLOCK();
} }
/* /*