in reply to How to do atomic file locking?

An alternative to file locking is socket locking. You might find some inspiration in the source of my Lock::Socket module. Basically, a process cannot bind an already bound socket.