[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parallel: This should not happen. You have found a bug.
From: |
Achim Gratz |
Subject: |
Re: parallel: This should not happen. You have found a bug. |
Date: |
Mon, 19 May 2014 11:31:16 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Ole Tange <tange <at> gnu.org> writes:
> I will be positive towards a patch that makes --semaphore work better
> on Windows/Cygwin as long as it does not break existing functionality
> on other platforms - especially the free platforms.
--- origsrc/parallel-20140422/src/parallel 2014-04-22 10:17:19.000000000
+0200
+++ src/parallel-20140422/src/parallel 2014-05-19 13:03:10.141273300 +0200
@@ -6905,8 +6905,12 @@ sub nlinks {
sub lock {
my $self = shift;
my $sleep = 100; # 100 ms
- open $self->{'lockfh'}, ">", $self->{'lockfile'}
- or ::die_bug("Can't open semaphore file $self->{'lockfile'}: $!");
+ my $tries = 5;
+ until (open $self->{'lockfh'}, ">", $self->{'lockfile'}) {
+ ::usleep(rand(5000));
+ --$tries
+ or ::die_bug("Can't open semaphore file $self->{'lockfile'}: $!");
+ }
chmod 0666, $self->{'lockfile'}; # assuming you want it a+rw
$Global::use{"Fcntl"} ||= eval "use Fcntl qw(:DEFAULT :flock); 1;";
while(not flock $self->{'lockfh'}, LOCK_EX()|LOCK_NB()) {
--- origsrc/parallel-20140422/src/sem 2014-04-22 10:17:19.000000000 +0200
+++ src/parallel-20140422/src/sem 2014-05-19 13:02:40.241283600 +0200
@@ -6905,8 +6905,12 @@ sub nlinks {
sub lock {
my $self = shift;
my $sleep = 100; # 100 ms
- open $self->{'lockfh'}, ">", $self->{'lockfile'}
- or ::die_bug("Can't open semaphore file $self->{'lockfile'}: $!");
+ my $tries = 5;
+ until (open $self->{'lockfh'}, ">", $self->{'lockfile'}) {
+ ::usleep(rand(5000));
+ --$tries
+ or ::die_bug("Can't open semaphore file $self->{'lockfile'}: $!");
+ }
chmod 0666, $self->{'lockfile'}; # assuming you want it a+rw
$Global::use{"Fcntl"} ||= eval "use Fcntl qw(:DEFAULT :flock); 1;";
while(not flock $self->{'lockfh'}, LOCK_EX()|LOCK_NB()) {
Regards,
Achim.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: parallel: This should not happen. You have found a bug.,
Achim Gratz <=