in reply to Threading in perl - using Locks
Also try to Super Search for lock or locking, it has been discussed here many times before.