mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 01:06:48 +00:00
Refactor Application shutdown using new Service, AsyncService interfaces
This commit is contained in:
41
src/ripple_net/basics/AsyncService.cpp
Normal file
41
src/ripple_net/basics/AsyncService.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
AsyncService::AsyncService (char const* name, Service& parent)
|
||||
: Service (name, parent)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncService::~AsyncService ()
|
||||
{
|
||||
// If this goes off it means the
|
||||
// AsyncService API contract was violated.
|
||||
//
|
||||
bassert (m_pendingIo.get() == 0);
|
||||
}
|
||||
|
||||
void AsyncService::serviceCountIoPending ()
|
||||
{
|
||||
++m_pendingIo;
|
||||
}
|
||||
|
||||
bool AsyncService::serviceCountIoComplete (boost::system::error_code const& ec)
|
||||
{
|
||||
// If this goes off, the count is unbalanced.
|
||||
bassert (m_pendingIo.get() > 0);
|
||||
|
||||
--m_pendingIo;
|
||||
|
||||
if (! ec || ec == boost::asio::error::operation_aborted)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void AsyncService::onServiceIoComplete ()
|
||||
{
|
||||
//serviceStopped();
|
||||
}
|
||||
Reference in New Issue
Block a user