der Riegel
bolt
A mechanical component, usually made of metal or wood, used to lock a door, gate, or window by being slid into an opening intended for it.
Er schob den schweren Riegel vor die Haustür.
He slid the heavy bolt across the front door.

bolt / bar
Loading your saved state.
bolt
A mechanical component, usually made of metal or wood, used to lock a door, gate, or window by being slid into an opening intended for it.
Er schob den schweren Riegel vor die Haustür.
He slid the heavy bolt across the front door.

You can recognize the meaning of 'Riegel' from the context. If it is about doors, it means the locking bolt. With food, it refers to a chocolate bar or granola bar. In a sports context, it means part of a piece of gymnastic equipment.
Schieb bitte den Riegel vor, bevor du schlafen gehst.
Please slide the bolt across before you go to sleep.
In the meaning of 'food item', 'Riegel' is almost always part of a compound word. The most common are 'Schokoriegel' (chocolate bar), 'Müsliriegel' (granola bar), 'Proteinriegel' (protein bar), and 'Energieriegel' (energy bar).
Nach dem Sport esse ich oft einen Proteinriegel.
After exercising, I often eat a protein bar.
The idiom 'einer Sache einen Riegel vorschieben' (to put a stop to something) has a fixed structure. The thing that is to be stopped is always in the dative.
Die Stadt will der illegalen Müllentsorgung einen Riegel vorschieben.
The city wants to put a stop to illegal waste disposal.
When the door lock is meant, the typical verbs are 'vorschieben' (to slide across / lock) and 'zurückziehen' (to pull back / open).
Aus Sicherheitsgründen schob sie den Riegel vor.
For safety reasons, she slid the bolt across.
castle / lock
'das Schloss' and 'der Riegel' can both be used to close a door, gate, or window and make it more secure. 'Schloss' usually means a mechanism that you open or lock with a key. 'Riegel' more often means a part that you slide sideways or forward, often made of metal or wood. The words can be confused because both are found on doors. Remember: a Schloss often needs a key; a Riegel is usually slid directly by hand.

Vor dem Schlafen schiebt Paul den Riegel am Gartentor zu.
Before going to sleep, Paul slides the bolt shut on the garden gate.
Das Schloss an der Haustür klemmt, deshalb brauche ich etwas länger.
The lock on the front door is sticking, so I need a little longer.