Section 124. The railroad corporation may erect, at a distance of five hundred feet from every drawbridge, or at such other distance as may on its application be prescribed by the department, and on each side thereof, a substantial barrier, so constructed and connected with the draw by suitable mechanism, that the draw, when in position for the passage of trains, cannot be opened or moved until the barriers have been closed across the track in such manner as to be a warning to any train which approaches in either direction.