Fix pthread key num calculation.

Bug: 18723085
Change-Id: Iba2c834b350e4cdba0b2d771b221560a3e5df952
This commit is contained in:
Yabin Cui
2014-12-11 20:50:41 -08:00
parent 6d634f9baa
commit 6c238f2926
5 changed files with 38 additions and 22 deletions

View File

@@ -191,7 +191,7 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
// At offsets >= 0, we have the TLS slots.
// At offsets < 0, we have the child stack.
thread->tls = reinterpret_cast<void**>(reinterpret_cast<uint8_t*>(thread->attr.stack_base) +
thread->attr.stack_size - BIONIC_TLS_SLOTS * sizeof(void*));
thread->attr.stack_size - BIONIC_ALIGN(BIONIC_TLS_SLOTS * sizeof(void*), 16));
void* child_stack = thread->tls;
__init_tls(thread);