Subject: | Small bug in remove_nb |
Date: | Tue, 18 Sep 2018 17:57:21 +0000 |
To: | "bug-Thread-Pool-Simple [...] rt.cpan.org" <bug-Thread-Pool-Simple [...] rt.cpan.org> |
From: | Todd Richmond <trichmond [...] proofpoint.com> |
There is a small logic error in sub_remove() when called from from remove_nb
--- Simple.pm 2018-02-07 16:13:31.000000000 -0800
+++ Simple.pm 2018-02-07 16:29:07.000000000 -0800
@@ -283,7 +283,9 @@ sub _remove {
cond_wait %{$self->{done}} until exists $self->{done}{$id};
cond_signal %{$self->{done}} if 1 < keys %{$self->{done}};
}
- $exist = ($ret) = delete $self->{done}{$id};
+ # Make remove_nb do what is expected
+ $exist = defined $self->{done}{$id} ? 1 : 0;
+ ($ret) = delete $self->{done}{$id};
}
$self->_drop($id) if $exist;
return $exist unless defined $ret;