fix pthread cond var usage