Redesign stoppable object pattern

This commit is contained in:
John Freeman
2021-05-26 17:45:41 -05:00
committed by manojsdoshi
parent c10c0be11b
commit a2a37a928a
92 changed files with 781 additions and 2460 deletions

View File

@@ -324,8 +324,7 @@ Pg::clear()
//-----------------------------------------------------------------------------
PgPool::PgPool(Section const& pgConfig, Stoppable& parent, beast::Journal j)
: Stoppable("PgPool", parent), j_(j)
PgPool::PgPool(Section const& pgConfig, beast::Journal j) : j_(j)
{
// Make sure that boost::asio initializes the SSL library.
{
@@ -501,13 +500,12 @@ PgPool::setup()
}
void
PgPool::onStop()
PgPool::stop()
{
std::lock_guard<std::mutex> lock(mutex_);
stop_ = true;
cond_.notify_all();
idle_.clear();
stopped();
JLOG(j_.info()) << "stopped";
}
@@ -595,9 +593,9 @@ PgPool::checkin(std::unique_ptr<Pg>& pg)
//-----------------------------------------------------------------------------
std::shared_ptr<PgPool>
make_PgPool(Section const& pgConfig, Stoppable& parent, beast::Journal j)
make_PgPool(Section const& pgConfig, beast::Journal j)
{
auto ret = std::make_shared<PgPool>(pgConfig, parent, j);
auto ret = std::make_shared<PgPool>(pgConfig, j);
ret->setup();
return ret;
}