mutex: fix recursive mutex bug for unix/linux