more rigorous implementation of pthread_once