Revert "libutil: allow graceful dropping of Pool::Handle"

This reverts commit 8075541d82d05347321d35b9934ccee5f82142f4.

Change-Id: I05fa6a9de1308a4827a6557cf2807eb47ca64da6
This commit is contained in:
eldritch horrors 2024-04-05 03:51:52 +02:00
parent 821ad98beb
commit c77b6e1fdd

View file

@ -108,19 +108,6 @@ public:
Handle(Pool & pool, std::shared_ptr<R> r) : pool(pool), r(r) { }
void drop(bool stillValid)
{
{
auto state_(pool.state.lock());
if (stillValid)
state_->idle.emplace_back(std::move(r));
assert(state_->inUse);
state_->inUse--;
}
pool.wakeup.notify_one();
r = nullptr;
}
public:
Handle(Handle && h) : pool(h.pool), r(h.r) { h.r.reset(); }
@ -128,13 +115,15 @@ public:
~Handle()
{
if (r)
drop(std::uncaught_exceptions() == 0);
}
void release()
if (!r) return;
{
drop(true);
auto state_(pool.state.lock());
if (!std::uncaught_exceptions())
state_->idle.push_back(ref<R>(r));
assert(state_->inUse);
state_->inUse--;
}
pool.wakeup.notify_one();
}
R * operator -> () { return &*r; }