Several types of alarms can be used in your room if you are skeptical about how efficient your door's lock is. These alarms can be the difference between a good night's rest and an uneasy evening with one eye open if you're staying alone at a hostel and feel unsafe.
Look for a door stopper with a built-in alarm that alerts you if anyone is trying to enter your room. If you're worried about a door stopper being too heavy to carry on your flight, invest in a lightweight version that attaches to a belt or bag as you travel. Simply turn it on and clip it to your door or luggage when you need it, and it will notify you if someone is trying to open the door or your suitcase.
A similar device is the personal alarm, which is becoming popular for solo female travelers. If you're being robbed, simply press the alarm, which is small enough to attach as a keychain to your bag, and it will create an ear-piercing noise that's designed to disorient thieves and alert those around you.