mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-25 15:37:56 +00:00
parallel: If flock is unimplemented: Wait for random*5 sec instead.
This commit is contained in:
parent
4612f69097
commit
e15b48be86
|
@ -4914,6 +4914,14 @@ sub lock {
|
|||
chmod 0666, $self->{'lockfile'}; # assuming you want it a+rw
|
||||
$Global::use{"Fcntl"} ||= eval "use Fcntl qw(:DEFAULT :flock);";
|
||||
while(not flock $self->{'lockfh'}, LOCK_EX()|LOCK_NB()) {
|
||||
if ($! =~ m/Function not implemented/) {
|
||||
print $Global::original_stderr
|
||||
("parallel: Warning: flock: $!");
|
||||
print "parallel: Will wait for a random while\n";
|
||||
::usleep(rand(5000));
|
||||
last;
|
||||
}
|
||||
|
||||
::debug("Cannot lock $self->{'lockfile'}");
|
||||
# TODO if timeout: last
|
||||
$sleep = ($sleep < 1000) ? ($sleep * 1.1) : ($sleep);
|
||||
|
|
Loading…
Reference in a new issue