Hello wise monks. I'd just like to know if file locking in perl is fail safe. If I have something like this in my code:
open(SEM, ">$semaphore_file") || die "Cannot create semaphore: $!";
flock(SEM, LOCK_EX) || die "Lock failed: $!";
#Do something here
Would any other instance of the same program be able to get passed the get_lock(); line without obtaining a lock first? Shouldn't the get_lock(); line make all instances of the same program "wait their turn" to get a lock before proceeding so that only one instance of the program gets to "Do something here" at a time?
Thanks in advance.