Boost.ASIO: upgrade io_service=>io_context, finally

This commit is contained in:
2026-05-30 11:59:42 -04:00
parent f100764bd8
commit 4266af545a
26 changed files with 91 additions and 90 deletions
@@ -58,7 +58,7 @@ IoUringAssemblyEngine::IoUringAssemblyEngine(
: parent(parent_),
frameAssemblyDesc(nullptr), ring{},
eventfdFd(-1), eventfdDesc(nullptr), eventfd_value(0),
stallTimer(parent_.device->componentThread->getIoService()),
stallTimer(parent_.device->componentThread->getIoContext()),
nDgramsPerStagingBufferFrame(nDgramsPerStagingBufferFrame_),
assembledSlotsTracker(nDgramsPerStagingBufferFrame_),
randomDevice(), randomGenerator(randomDevice())
@@ -170,9 +170,9 @@ void IoUringAssemblyEngine::finalize()
bool wasAcceptingRequests = stop();
{
auto& ioService = smoHooksPtr->ComponentThread_getSelf()->getIoService();
sscl::cps::AsynchronousBridge bridge(ioService);
boost::asio::deadline_timer timeoutTimer(ioService);
auto& ioContext = smoHooksPtr->ComponentThread_getSelf()->getIoContext();
sscl::cps::AsynchronousBridge bridge(ioContext);
boost::asio::deadline_timer timeoutTimer(ioContext);
/** EXPLANATION:
* We wait for IOURINGASSM_ENGN_FRAME_ASSEM_TIMEOUT_MS + 1 ms to ensure
@@ -196,7 +196,7 @@ void IoUringAssemblyEngine::finalize()
bridge.setAsyncOperationComplete();
});
bridge.waitForAsyncOperationCompleteOrIoServiceStopped();
bridge.waitForAsyncOperationCompleteOrIoContextStopped();
}
if (eventfdFd >= 0)
@@ -265,7 +265,7 @@ void IoUringAssemblyEngine::resetAndAssembleFrame(
}
eventfdDesc = std::make_unique<boost::asio::posix::stream_descriptor>(
parent.device->componentThread->getIoService(), eventfdFd);
parent.device->componentThread->getIoContext(), eventfdFd);
if (!eventfdDesc)
{
@@ -375,7 +375,7 @@ cleanup_eventfd:
if (eventfdDesc)
{
/** EXPLANATION:
* The goal here is to ensure that our io_service's event loop will not
* The goal here is to ensure that our io_context's event loop will not
* get any events from the eventfd after we've called
* assemblyCycleComplete(). So we completely deinitialize the eventfd
* descriptor.
@@ -386,7 +386,7 @@ cleanup_eventfd:
* is not closed.
*
* However, we need to close the descriptor's association with the
* io_service before releasing it, otherwise Boost.Asio will complain
* io_context before releasing it, otherwise Boost.Asio will complain
* when we try to create a new descriptor with the same fd.
*/
/** CAVEAT:
@@ -645,7 +645,7 @@ void IoUringAssemblyEngine::assembleFrameReq(
auto request = std::make_shared<AssembleFrameReq>(
*this, caller, std::move(cb));
parent.device->componentThread->getIoService().post(
boost::asio::post(parent.device->componentThread->getIoContext(),
STC(std::bind(
&AssembleFrameReq::assembleFrameReq1_posted,
request.get(), request)));