From eb4e601eafaea28f99e5f76a044c8240217d8735 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 7 Feb 2024 10:59:49 +0100 Subject: [PATCH] Remove unused IoBoundWorkSlot --- lib/base/io-engine.cpp | 23 ----------------------- lib/base/io-engine.hpp | 20 -------------------- 2 files changed, 43 deletions(-) diff --git a/lib/base/io-engine.cpp b/lib/base/io-engine.cpp index 0792be5cc..7928ab19d 100644 --- a/lib/base/io-engine.cpp +++ b/lib/base/io-engine.cpp @@ -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> IoEngine::m_Instance ([]() { return std::unique_ptr(new IoEngine()); }); IoEngine& IoEngine::Get() diff --git a/lib/base/io-engine.hpp b/lib/base/io-engine.hpp index 0883d7810..bc842912b 100644 --- a/lib/base/io-engine.hpp +++ b/lib/base/io-engine.hpp @@ -50,25 +50,6 @@ private: 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 * @@ -77,7 +58,6 @@ private: class IoEngine { friend CpuBoundWork; - friend IoBoundWorkSlot; public: IoEngine(const IoEngine&) = delete;