Hi all,
as an 'old real time programmer' this reminds me deeply at Dijkstra/Hoare's "Dining philosophers problem".
The check for presence of the lockfile and the generation of it are not 'atomic'. Means two programs can run in parallel.
I'll investigate this further. But the deletion of the lock should happen anyways, as far I've seen till now.
Regards, Bernhard