X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e5e5accbefb1b4a360da4247ce287d1466b0f352..d177472fea36c2a8f780637477591025663d30a4:/tools/sg_unit_extractor.pl diff --git a/tools/sg_unit_extractor.pl b/tools/sg_unit_extractor.pl index 4e233f1e17..37b702593e 100755 --- a/tools/sg_unit_extractor.pl +++ b/tools/sg_unit_extractor.pl @@ -1,6 +1,13 @@ #! /usr/bin/perl use strict; +use Fcntl ':flock'; + +open SELF, "< $0" or die "Cannot open the lock file"; +if (!flock SELF, LOCK_EX | LOCK_NB) { + print STDERR "sg_unit_extractor already running. Cancelling...\n"; + exit; +} my $progname="sg_unit_extractor"; # Get the args