What what it's worth, I'd like to endorse the solution offered by adamk earlier in the thread. I had been handling a similar problem through the use of lockfiles, but it wasn't working out too well. I decided to give adamk's suggestion a try and it absolutely works a treat. It's also nice and neat and very easy to implement.
I ran into a situation at work where I needed some kind of locking, and I too used adamk's solution, and it worked like a charm. It even worked over NFS! Thanks, adamk.