What must be mandatory is the distance between the man holding the red flag on the side of the road and the actual danger.

Most of the times, the guy holding the flag is exactly at the place of the danger. We know driving is all about anticipation. Therefore, the man holding the flag must be something like 100 meters before the actual danger zone.