diff options
Diffstat (limited to 'lib/App/Glacier/DB/GDBM.pm')
-rw-r--r-- | lib/App/Glacier/DB/GDBM.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/App/Glacier/DB/GDBM.pm b/lib/App/Glacier/DB/GDBM.pm index 0e14a65..f7cc29a 100644 --- a/lib/App/Glacier/DB/GDBM.pm +++ b/lib/App/Glacier/DB/GDBM.pm @@ -5,8 +5,12 @@ use GDBM_File; use Carp; use File::Basename; use File::Path qw(make_path); +# Avoid coredumps in threaded code. +# See https://rt.perl.org/Public/Bug/Display.html?id=61912. +sub CLONE_SKIP { 1 } + sub new { my $class = shift; local %_ = @_; my $file = delete $_{file} // croak "filename is required"; @@ -51,13 +55,10 @@ sub configtest { my ($class, $cfg, @path) = @_; $cfg->lint(\%lexicon, @path); } -# We can't tie the DB to $self->{_map} at once, in the new method, because -# this will cause coredumps in threaded code (see -# https://rt.perl.org/Public/Bug/Display.html?id=61912). So, the following -# auxiliary method is used, which calls &$code with $self->{_map} tied -# to the DB. +# Tie in the database, run $code, and untie it again. Correctly handle +# nested invocations to avoid deadlocking. sub _tied { my ($self, $code) = @_; croak "argument must be a CODE ref" unless ref($code) eq 'CODE'; if ($self->{_nref}++ == 0) { |