Merge "Fix pthread_detach for already-exited threads."