move some more code out of pthread_create.c