pthread_cleanup_push and pthread_cleanup_pop should be in matched pairs