https://fedorahosted.org/sssd/ticket/1460
Please see the commit. I'm wondering if there is still a (small) race
condition between the call to pthread_cleanup_pop() and unlocking the
mutex. Would it be better to i.e. always call the cleanup handler with
pthread_cleanup_pop(1) and disconnect from the fd based on some other
condition?