Hello Wise Monks. In the code below, is there any chance at all that "some code" will be executed more than once in the same instance assuming 2 instances of this code are run at exactly the same time? My expectation is that one instance of the program will have to wait for the other to release the lock before executing "some code". (I'm using red had linux 7.1)
open(SEM, ">semaphore_file") || die "Cannot create semaphore $!";
flock(SEM, LOCK_EX) || die "Lock failed: $!";
#some code
close(SEM);