How to make a lock using system.util.getGlobals()?

This topic and its linked topics have additional guidance and examples: