The railway's responsibility is having a ten-nines reliable (or whatever it is) signalling system, to be practically certain that the lights, alarms and barriers of the level crossing work correctly every time. (Or fail safe, i.e. fail to the barriers lowering.)