Use int instead of bool for pthread lock check