The answer depends on the position of the gate. While it is closed or closing, driving onto a railroad crossing is prohibited, whatever the traffic light shows. So the driver stops before the crossing and waits for the gate to open: it is lowered in advance, and a train may appear sooner than it seems