make last thread's pthread_exit give exit(0) a consistent state