mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
Remove unused IoBoundWorkSlot
This commit is contained in:
parent
3d5e031adf
commit
eb4e601eaf
@ -50,29 +50,6 @@ void CpuBoundWork::Done()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IoBoundWorkSlot::IoBoundWorkSlot(boost::asio::yield_context yc)
|
|
||||||
: yc(yc)
|
|
||||||
{
|
|
||||||
IoEngine::Get().m_CpuBoundSemaphore.fetch_add(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
IoBoundWorkSlot::~IoBoundWorkSlot()
|
|
||||||
{
|
|
||||||
auto& ioEngine (IoEngine::Get());
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
auto availableSlots (ioEngine.m_CpuBoundSemaphore.fetch_sub(1));
|
|
||||||
|
|
||||||
if (availableSlots < 1) {
|
|
||||||
ioEngine.m_CpuBoundSemaphore.fetch_add(1);
|
|
||||||
IoEngine::YieldCurrentCoroutine(yc);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LazyInit<std::unique_ptr<IoEngine>> IoEngine::m_Instance ([]() { return std::unique_ptr<IoEngine>(new IoEngine()); });
|
LazyInit<std::unique_ptr<IoEngine>> IoEngine::m_Instance ([]() { return std::unique_ptr<IoEngine>(new IoEngine()); });
|
||||||
|
|
||||||
IoEngine& IoEngine::Get()
|
IoEngine& IoEngine::Get()
|
||||||
|
@ -50,25 +50,6 @@ private:
|
|||||||
bool m_Done;
|
bool m_Done;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Scope break for CPU-bound work done in an I/O thread
|
|
||||||
*
|
|
||||||
* @ingroup base
|
|
||||||
*/
|
|
||||||
class IoBoundWorkSlot
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
IoBoundWorkSlot(boost::asio::yield_context yc);
|
|
||||||
IoBoundWorkSlot(const IoBoundWorkSlot&) = delete;
|
|
||||||
IoBoundWorkSlot(IoBoundWorkSlot&&) = delete;
|
|
||||||
IoBoundWorkSlot& operator=(const IoBoundWorkSlot&) = delete;
|
|
||||||
IoBoundWorkSlot& operator=(IoBoundWorkSlot&&) = delete;
|
|
||||||
~IoBoundWorkSlot();
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::asio::yield_context yc;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Async I/O engine
|
* Async I/O engine
|
||||||
*
|
*
|
||||||
@ -77,7 +58,6 @@ private:
|
|||||||
class IoEngine
|
class IoEngine
|
||||||
{
|
{
|
||||||
friend CpuBoundWork;
|
friend CpuBoundWork;
|
||||||
friend IoBoundWorkSlot;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IoEngine(const IoEngine&) = delete;
|
IoEngine(const IoEngine&) = delete;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user