in reply to Re: Fcntl() and multiple filehandles
in thread Fcntl() and multiple filehandles

Unless you really have to have simultaneous access for multiple scripts or instances of your script, you should be able to make do by checking for lock file, and if it's there, sleeping for a second and checking again, rinse and repeat. If the lock file isn't gone after x number of iterations, and if the lock file is the same one that was there when you started iterating, you can assume that the script that locked it died or hung up, and ignore / delete the lock and create your own.

WWWBoard comes with file lock routines - you can always look at these and use them as the basis for writing your own lock / unlock routines.

Replies are listed 'Best First'.
Re^3: Fcntl() and multiple filehandles
by Anonymous Monk on Sep 21, 2004 at 11:28 UTC
    Hmmm...but what's to lock the lock files? E.g. what happens if two processes try to create a lock file at the same time?