optimize POSIX TSD for fast pthread_getspecific

This commit is contained in:
Rich Felker
2011-03-03 18:30:44 -05:00
parent a53d2f3425
commit b480808a6a
4 changed files with 14 additions and 9 deletions

View File

@ -12,6 +12,7 @@ int pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
int i = (uintptr_t)&k / 16 % PTHREAD_KEYS_MAX;
int j = i;
pthread_self();
libc.tsd_keys = keys;
if (!dtor) dtor = nodtor;
/* Cheap trick - &k cannot match any destructor pointer */