Async-ResourcePool
view release on metacpan or search on metacpan
$instances++;
return bless { %args, closed => 0, events => [] }, $class;
}
sub make_use_of {
my ($self) = @_;
push $self->{events}, "make_use_of";
fail "We're not supposed to be alive" if $self->{closed};
}
sub release {
my ($self) = @_;
pass "released";
push $self->{events}, "release";
local $, = "\n";
# It may occasionally happen since release() re-enters the dispatching of
#
# Async::ResourcePool and if something is released and closed in rapid
# succession, by more than one task, the result will be two calls to ->close()
# one right before a call to ->release().
#
# This race condition should be allowed so long as the resource is still valid,
# but Async::ResourcePool may never dispatch it (there's a test below for
# that).
#
die "We're not supposed to be alive in release:\n@{$self->{events}}"
if $self->{closed};
$self->{pool}->release($self);
}
sub close {
my ($self) = @_;
pass "closed";
push $self->{events}, "close";
( run in 1.607 second using v1.01-cache-2.11-cpan-df04353d9ac )