Workaround dclone() not being thread-safe
This commit is contained in:
parent
9dbf21235c
commit
8d1069766b
@ -32,6 +32,11 @@ sub clone {
|
|||||||
Storable::dclone($_[0])
|
Storable::dclone($_[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub threadsafe_clone {
|
||||||
|
my $self = shift;
|
||||||
|
return (ref $self)->new(map $_->threadsafe_clone, @$self);
|
||||||
|
}
|
||||||
|
|
||||||
sub contour {
|
sub contour {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $self->[0];
|
return $self->[0];
|
||||||
@ -303,7 +308,7 @@ has 'expolygons' => (is => 'ro', default => sub { [] });
|
|||||||
sub clone {
|
sub clone {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return (ref $self)->new(
|
return (ref $self)->new(
|
||||||
expolygons => [ map $_->clone, @{$self->expolygons} ],
|
expolygons => [ map $_->threadsafe_clone, @{$self->expolygons} ],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,11 @@ sub clone {
|
|||||||
Storable::dclone($_[0])
|
Storable::dclone($_[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub threadsafe_clone {
|
||||||
|
my $self = shift;
|
||||||
|
return (ref $self)->new(@$self);
|
||||||
|
}
|
||||||
|
|
||||||
sub coincides_with {
|
sub coincides_with {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($point) = @_;
|
my ($point) = @_;
|
||||||
|
@ -22,6 +22,11 @@ sub clone {
|
|||||||
Storable::dclone($_[0])
|
Storable::dclone($_[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub threadsafe_clone {
|
||||||
|
my $self = shift;
|
||||||
|
return (ref $self)->new(map $_->threadsafe_clone, @$self);
|
||||||
|
}
|
||||||
|
|
||||||
sub serialize {
|
sub serialize {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return pack 'l*', map @$_, @$self;
|
return pack 'l*', map @$_, @$self;
|
||||||
|
Loading…
Reference in New Issue
Block a user