Put tid++ in the loop body