http://qs1969.pair.com?node_id=178994


in reply to A flock()alypse now

This should work fine for a single file. Semaphores are required for multiple file locking of course, but that was covered above. By openning the file twice with different filehandles you're just getting a different file descriptor to work with. flock locks files, not file descriptors. Even using system calls dup and fork just cause multiple references to the same lock.