Light Barrier Sensor - clocked or non-clocked light?
If the emitted beam is mot modulated, it can be hard for the detector to distinguish between the emitter and stray background light.  For instance, if the sun shines through a window onto the wall next to the emitter, then the detector may remain stuck on even if something breaks the beam.

Modulating the emitter allows the detector to filter out anything other than the emitted beam.  A 4000 Hz bandpass filter would be one way to do this.  A phase locked loop would be another.  Either way, a steady light can be ignored and only a modulated one will be accepted.