fix data race choosing next key slot in pthread_key_create