diff options
-rw-r--r-- | ext/IO/lib/IO/Poll.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/IO/lib/IO/Poll.pm b/ext/IO/lib/IO/Poll.pm index 70a3469edb..89b89d4d13 100644 --- a/ext/IO/lib/IO/Poll.pm +++ b/ext/IO/lib/IO/Poll.pm @@ -13,7 +13,7 @@ use Exporter (); our(@ISA, @EXPORT_OK, @EXPORT, $VERSION); @ISA = qw(Exporter); -$VERSION = "0.05"; +$VERSION = "0.06"; @EXPORT = qw( POLLIN POLLOUT @@ -53,9 +53,13 @@ sub mask { $self->[1]{$fd} = 0; # output mask $self->[2]{$io} = $io; # remember handle } else { - delete $self->[0]{$fd}{$io}; - delete $self->[1]{$fd} unless %{$self->[0]{$fd}}; - delete $self->[2]{$io}; + delete $self->[0]{$fd}{$io}; + unless(%{$self->[0]{$fd}}) { + # We no longer have any handles for this FD + delete $self->[1]{$fd}; + delete $self->[0]{$fd}; + } + delete $self->[2]{$io}; } } |