Boost.ASIO: upgrade io_service=>io_context, finally
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <algorithm>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <opts.h>
|
||||
|
||||
@@ -19,7 +19,7 @@ BroadcastListener::BroadcastListener(
|
||||
listeningPort(listeningPort),
|
||||
connectPort(connectPort),
|
||||
deviceGoneAwayCb(nullptr),
|
||||
socket(componentThread->getIoService()),
|
||||
socket(componentThread->getIoContext()),
|
||||
listeningEndpoint(boost::asio::ip::udp::v4(), listeningPort),
|
||||
isListening(false)
|
||||
{
|
||||
|
||||
@@ -1098,7 +1098,7 @@ void Device::startHeartbeat()
|
||||
|
||||
// Create heartbeat timer
|
||||
heartbeatTimer = std::make_unique<boost::asio::deadline_timer>(
|
||||
componentThread->getIoService());
|
||||
componentThread->getIoContext());
|
||||
|
||||
heartbeatActive.store(true);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace endian {
|
||||
// IPv4 address validation
|
||||
inline bool isValidIPv4(const std::string& ipAddress) {
|
||||
boost::system::error_code ec;
|
||||
boost::asio::ip::address_v4::from_string(ipAddress, ec);
|
||||
(void)boost::asio::ip::make_address_v4(ipAddress, ec);
|
||||
return !ec;
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ void UdpCommandDemuxer::setupCommandSocket()
|
||||
|
||||
// Create boost wrapper for async operations
|
||||
cmdEndpointFdDesc = std::make_shared<boost::asio::posix::stream_descriptor>(
|
||||
componentThread->getIoService(), socketGuard.getFd());
|
||||
componentThread->getIoContext(), socketGuard.getFd());
|
||||
|
||||
// Transfer ownership, prevent auto-close
|
||||
socketGuard.commit();
|
||||
@@ -269,7 +269,7 @@ void UdpCommandDemuxer::setupPcloudDataSocket()
|
||||
|
||||
// Create boost wrapper for async operations
|
||||
pcloudDataFdDesc = std::make_shared<boost::asio::posix::stream_descriptor>(
|
||||
componentThread->getIoService(), socketGuard.getFd());
|
||||
componentThread->getIoContext(), socketGuard.getFd());
|
||||
|
||||
// Transfer ownership, prevent auto-close
|
||||
socketGuard.commit();
|
||||
@@ -419,16 +419,16 @@ void UdpCommandDemuxer::processIncomingData()
|
||||
struct UdpCommandDemuxer::PendingCommandWaitDesc
|
||||
{
|
||||
CommandWaitKey key;
|
||||
boost::asio::io_service &resumeIoService;
|
||||
boost::asio::io_context &resumeIoContext;
|
||||
std::atomic<bool> settled{false};
|
||||
UdpCommandResponseResult result{};
|
||||
std::coroutine_handle<> callerSchedHandle;
|
||||
|
||||
PendingCommandWaitDesc(
|
||||
CommandWaitKey keyIn,
|
||||
boost::asio::io_service &resumeIoServiceIn)
|
||||
boost::asio::io_context &resumeIoContextIn)
|
||||
: key(std::move(keyIn)),
|
||||
resumeIoService(resumeIoServiceIn)
|
||||
resumeIoContext(resumeIoContextIn)
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -458,7 +458,7 @@ void UdpCommandDemuxer::settlePendingCommandWait(
|
||||
return;
|
||||
}
|
||||
|
||||
boost::asio::post(wait->resumeIoService, handle);
|
||||
boost::asio::post(wait->resumeIoContext, handle);
|
||||
}
|
||||
|
||||
std::shared_ptr<UdpCommandDemuxer::PendingCommandWaitDesc>
|
||||
@@ -518,7 +518,7 @@ UdpCommandDemuxer::waitForCommandResponseCReq(
|
||||
{
|
||||
const CommandWaitKey key{deviceIp, cmdSet, cmdId};
|
||||
auto wait = std::make_shared<PendingCommandWaitDesc>(
|
||||
key, componentThread->getIoService());
|
||||
key, componentThread->getIoContext());
|
||||
|
||||
{
|
||||
sscl::SpinLock::Guard guard(pendingWaits.lock);
|
||||
@@ -577,10 +577,10 @@ UdpCommandDemuxer::waitForCommandResponseCReq(
|
||||
* request. If the device does not respond within the timeout period,
|
||||
* we will consider the command to have failed.
|
||||
*/
|
||||
boost::asio::io_service &ioService = componentThread->getIoService();
|
||||
boost::asio::io_context &ioContext = componentThread->getIoContext();
|
||||
std::optional<std::shared_ptr<boost::asio::deadline_timer>> raceTimer;
|
||||
auto timerAwaiter = adapters::boostAsio::getDeadlineTimerAReqAwaiter(
|
||||
ioService,
|
||||
ioContext,
|
||||
boost::posix_time::milliseconds(timeoutMs),
|
||||
raceTimer);
|
||||
auto responseInvoker = waitForCommandResponseCReq(cmdSet, cmdId, deviceIp);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <optional>
|
||||
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
@@ -29,14 +29,14 @@ public:
|
||||
};
|
||||
|
||||
DeadlineTimerAReq(
|
||||
boost::asio::io_service &resumeIoService,
|
||||
boost::asio::io_context &resumeIoContext,
|
||||
const boost::posix_time::milliseconds delay,
|
||||
std::optional<std::shared_ptr<boost::asio::deadline_timer>> &timerOut)
|
||||
: asyncState(std::make_shared<AsyncState>()),
|
||||
resumeIoService(resumeIoService)
|
||||
resumeIoContext(resumeIoContext)
|
||||
{
|
||||
asyncState->timer =
|
||||
std::make_shared<boost::asio::deadline_timer>(resumeIoService);
|
||||
std::make_shared<boost::asio::deadline_timer>(resumeIoContext);
|
||||
timerOut = asyncState->timer;
|
||||
|
||||
asyncState->timer->expires_from_now(delay);
|
||||
@@ -85,27 +85,27 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
boost::asio::post(resumeIoService, handle);
|
||||
boost::asio::post(resumeIoContext, handle);
|
||||
}
|
||||
|
||||
std::shared_ptr<AsyncState> asyncState;
|
||||
boost::asio::io_service &resumeIoService;
|
||||
boost::asio::io_context &resumeIoContext;
|
||||
};
|
||||
|
||||
inline auto getDeadlineTimerAReqAwaiter(
|
||||
boost::asio::io_service &ioService,
|
||||
boost::asio::io_context &ioContext,
|
||||
const boost::posix_time::milliseconds delay)
|
||||
{
|
||||
std::optional<std::shared_ptr<boost::asio::deadline_timer>> timerOut;
|
||||
return DeadlineTimerAReq(ioService, delay, timerOut);
|
||||
return DeadlineTimerAReq(ioContext, delay, timerOut);
|
||||
}
|
||||
|
||||
inline auto getDeadlineTimerAReqAwaiter(
|
||||
boost::asio::io_service &ioService,
|
||||
boost::asio::io_context &ioContext,
|
||||
const boost::posix_time::milliseconds delay,
|
||||
std::optional<std::shared_ptr<boost::asio::deadline_timer>> &timerOut)
|
||||
{
|
||||
return DeadlineTimerAReq(ioService, delay, timerOut);
|
||||
return DeadlineTimerAReq(ioContext, delay, timerOut);
|
||||
}
|
||||
|
||||
} // namespace adapters::boostAsio
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
#include <spinscale/cps/callback.h>
|
||||
|
||||
@@ -30,10 +30,10 @@ public:
|
||||
};
|
||||
|
||||
CpsCallbackAReq(
|
||||
boost::asio::io_service &resumeIoService,
|
||||
boost::asio::io_context &resumeIoContext,
|
||||
StartFn startFn)
|
||||
: asyncState(std::make_shared<AsyncState>()),
|
||||
resumeIoService(resumeIoService)
|
||||
resumeIoContext(resumeIoContext)
|
||||
{
|
||||
startFn(sscl::cps::Callback<CallbackFn>{
|
||||
nullptr,
|
||||
@@ -80,11 +80,11 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
boost::asio::post(resumeIoService, handle);
|
||||
boost::asio::post(resumeIoContext, handle);
|
||||
}
|
||||
|
||||
std::shared_ptr<AsyncState> asyncState;
|
||||
boost::asio::io_service &resumeIoService;
|
||||
boost::asio::io_context &resumeIoContext;
|
||||
};
|
||||
|
||||
} // namespace cpsBoundary
|
||||
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
* The SmoCallbacks parameter provides the library with access to
|
||||
* Salmanoff's hooks.
|
||||
* The SmoThreadingModelDesc parameter provides the library with access to
|
||||
* the io_service for network operations and event handling.
|
||||
* the io_context for network operations and event handling.
|
||||
*/
|
||||
typedef const StimBuffApiDesc &(SMO_GET_STIM_BUFF_API_DESC_FN_TYPEDEF)(
|
||||
const SmoCallbacks& callbacks,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <config.h>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <spinscale/spinLock.h>
|
||||
#include <spinscale/syncCancelerForAsyncWork.h>
|
||||
@@ -39,10 +39,10 @@ public:
|
||||
explicit StimulusProducer(
|
||||
const std::shared_ptr<device::DeviceAttachmentSpec>
|
||||
&deviceAttachmentSpec,
|
||||
boost::asio::io_service& ioService_)
|
||||
boost::asio::io_context& ioContext_)
|
||||
: deviceAttachmentSpec(deviceAttachmentSpec),
|
||||
ioService(ioService_),
|
||||
timer(ioService), nDeferrals(0)
|
||||
ioContext(ioContext_),
|
||||
timer(ioContext), nDeferrals(0)
|
||||
{}
|
||||
|
||||
virtual ~StimulusProducer() = default;
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
std::vector<std::shared_ptr<StimulusBuffer>> attachedStimulusBuffers;
|
||||
|
||||
private:
|
||||
boost::asio::io_service& ioService;
|
||||
boost::asio::io_context& ioContext;
|
||||
protected:
|
||||
sscl::SyncCancelerForAsyncWork stimulusProducerCanceler;
|
||||
private:
|
||||
|
||||
+1
-1
Submodule libspinscale updated: 0afa3e16b8...3ea1475757
@@ -1,3 +1,4 @@
|
||||
#include <boostAsioLinkageFix.h>
|
||||
#include <iostream>
|
||||
#include <pthread.h>
|
||||
#include <componentThread.h>
|
||||
@@ -18,13 +19,13 @@ int main(int argc, char *argv[], char *envp[])
|
||||
*/
|
||||
std::cout << "CRT:" << __func__ << ": about to JOLT Mrntt with cmdline args"
|
||||
<< '\n';
|
||||
smo::mrntt::thread->getIoService().post(
|
||||
boost::asio::post(smo::mrntt::thread->getIoContext(),
|
||||
[argc, argv, envp]()
|
||||
{
|
||||
std::cout << "Mrntt:" << __func__ << ":JOLTED: setting cmdline args"
|
||||
<< '\n';
|
||||
sscl::CrtCommandLineArgs::set(argc, argv, envp);
|
||||
smo::mrntt::thread->getIoService().stop();
|
||||
smo::mrntt::thread->getIoContext().stop();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -13,73 +13,73 @@
|
||||
namespace smo {
|
||||
namespace mrntt {
|
||||
|
||||
boost::asio::io_service &MrnttThreadTag::io_service() noexcept
|
||||
boost::asio::io_context &MrnttThreadTag::io_context() noexcept
|
||||
{
|
||||
return thread->getIoService();
|
||||
return thread->getIoContext();
|
||||
}
|
||||
|
||||
} // namespace mrntt
|
||||
|
||||
namespace body {
|
||||
|
||||
boost::asio::io_service &BodyThreadTag::io_service()
|
||||
boost::asio::io_context &BodyThreadTag::io_context()
|
||||
{
|
||||
if (!mind::globalMind) {
|
||||
throw std::runtime_error(
|
||||
"BodyThreadTag: globalMind not initialized");
|
||||
}
|
||||
|
||||
return mind::globalMind->body.thread->getIoService();
|
||||
return mind::globalMind->body.thread->getIoContext();
|
||||
}
|
||||
|
||||
} // namespace body
|
||||
|
||||
namespace director {
|
||||
|
||||
boost::asio::io_service &DirectorThreadTag::io_service()
|
||||
boost::asio::io_context &DirectorThreadTag::io_context()
|
||||
{
|
||||
if (!mind::globalMind) {
|
||||
throw std::runtime_error(
|
||||
"DirectorThreadTag: globalMind not initialized");
|
||||
}
|
||||
|
||||
return mind::globalMind->director.thread->getIoService();
|
||||
return mind::globalMind->director.thread->getIoContext();
|
||||
}
|
||||
|
||||
} // namespace director
|
||||
|
||||
namespace simulator {
|
||||
|
||||
boost::asio::io_service &SimulatorThreadTag::io_service()
|
||||
boost::asio::io_context &SimulatorThreadTag::io_context()
|
||||
{
|
||||
if (!mind::globalMind) {
|
||||
throw std::runtime_error(
|
||||
"SimulatorThreadTag: globalMind not initialized");
|
||||
}
|
||||
|
||||
return mind::globalMind->canvas.thread->getIoService();
|
||||
return mind::globalMind->canvas.thread->getIoContext();
|
||||
}
|
||||
|
||||
} // namespace simulator
|
||||
|
||||
boost::asio::io_service &SubconsciousThreadTag::io_service()
|
||||
boost::asio::io_context &SubconsciousThreadTag::io_context()
|
||||
{
|
||||
if (!mind::globalMind) {
|
||||
throw std::runtime_error(
|
||||
"SubconsciousThreadTag: globalMind not initialized");
|
||||
}
|
||||
|
||||
return mind::globalMind->subconscious.thread->getIoService();
|
||||
return mind::globalMind->subconscious.thread->getIoContext();
|
||||
}
|
||||
|
||||
boost::asio::io_service &WorldThreadTag::io_service()
|
||||
boost::asio::io_context &WorldThreadTag::io_context()
|
||||
{
|
||||
if (!mind::globalMind) {
|
||||
throw std::runtime_error(
|
||||
"WorldThreadTag: globalMind not initialized");
|
||||
}
|
||||
|
||||
return mind::globalMind->world.thread->getIoService();
|
||||
return mind::globalMind->world.thread->getIoContext();
|
||||
}
|
||||
|
||||
} // namespace smo
|
||||
|
||||
@@ -18,7 +18,7 @@ constexpr unsigned int reattachInFlightStaleThresholdMultiplier = 4;
|
||||
|
||||
DeviceReattacher::DeviceReattacher(
|
||||
DeviceManager& parent, std::shared_ptr<sscl::ComponentThread> ioThread)
|
||||
: parent(parent), ioThread(ioThread), timer(ioThread->getIoService())
|
||||
: parent(parent), ioThread(ioThread), timer(ioThread->getIoContext())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SMO_BODY_THREAD_H
|
||||
#define SMO_BODY_THREAD_H
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <spinscale/co/invokers.h>
|
||||
#include <spinscale/co/postingPromise.h>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace body {
|
||||
|
||||
struct BodyThreadTag
|
||||
{
|
||||
static boost::asio::io_service &io_service();
|
||||
static boost::asio::io_context &io_context();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SMO_DIRECTOR_THREAD_H
|
||||
#define SMO_DIRECTOR_THREAD_H
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <spinscale/co/invokers.h>
|
||||
#include <spinscale/co/postingPromise.h>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace director {
|
||||
|
||||
struct DirectorThreadTag
|
||||
{
|
||||
static boost::asio::io_service &io_service();
|
||||
static boost::asio::io_context &io_context();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SMO_MARIONETTE_THREAD_H
|
||||
#define SMO_MARIONETTE_THREAD_H
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <spinscale/co/invokers.h>
|
||||
#include <spinscale/co/postingPromise.h>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace mrntt {
|
||||
|
||||
struct MrnttThreadTag
|
||||
{
|
||||
static boost::asio::io_service &io_service() noexcept;
|
||||
static boost::asio::io_context &io_context() noexcept;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SMO_SIMULATOR_THREAD_H
|
||||
#define SMO_SIMULATOR_THREAD_H
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <spinscale/co/invokers.h>
|
||||
#include <spinscale/co/postingPromise.h>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace simulator {
|
||||
|
||||
struct SimulatorThreadTag
|
||||
{
|
||||
static boost::asio::io_service &io_service();
|
||||
static boost::asio::io_context &io_context();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SMO_SUBCONSCIOUS_THREAD_H
|
||||
#define SMO_SUBCONSCIOUS_THREAD_H
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <spinscale/co/invokers.h>
|
||||
#include <spinscale/co/postingPromise.h>
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace smo {
|
||||
|
||||
struct SubconsciousThreadTag
|
||||
{
|
||||
static boost::asio::io_service &io_service();
|
||||
static boost::asio::io_context &io_context();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SMO_WORLD_THREAD_H
|
||||
#define SMO_WORLD_THREAD_H
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <spinscale/co/invokers.h>
|
||||
#include <spinscale/co/postingPromise.h>
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace smo {
|
||||
|
||||
struct WorldThreadTag
|
||||
{
|
||||
static boost::asio::io_service &io_service();
|
||||
static boost::asio::io_context &io_context();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -103,7 +103,7 @@ void MarionetteComponent::exceptionInd()
|
||||
auto puppeteer = sscl::ComponentThread::getPptr();
|
||||
|
||||
boost::asio::post(
|
||||
puppeteer->getIoService(),
|
||||
puppeteer->getIoContext(),
|
||||
[]
|
||||
{
|
||||
mrntt.holdFinalizeCReq(
|
||||
|
||||
@@ -63,7 +63,7 @@ void MarionetteComponent::postJoltHook()
|
||||
|
||||
// Register SIGINT (Ctrl+C) and SIGSEGV handlers
|
||||
signals = std::make_unique<boost::asio::signal_set>(
|
||||
th->getIoService(), SIGINT);
|
||||
th->getIoContext(), SIGINT);
|
||||
|
||||
signals->async_wait(
|
||||
[](const boost::system::error_code& ec, int signal)
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <atomic>
|
||||
#include <random>
|
||||
#include <liburing.h>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <boost/asio/posix/stream_descriptor.hpp>
|
||||
#include <livoxProto1/device.h>
|
||||
|
||||
@@ -355,9 +355,9 @@ attachByCreatingProducer(
|
||||
/* Delay here because getOrCreate just sent HandshakeReq, so device
|
||||
* may not yet be ready for another command.
|
||||
*/
|
||||
// Initialize timer with LivoxGen1 metadata io_service
|
||||
// Initialize timer with LivoxGen1 metadata io_context
|
||||
const bool delayOk = co_await adapters::boostAsio::getDeadlineTimerAReqAwaiter(
|
||||
componentThread->getIoService(),
|
||||
componentThread->getIoContext(),
|
||||
boost::posix_time::milliseconds(LIVOX_GEN1_DEVICE_COMMAND_DELAY_MS));
|
||||
|
||||
if (!delayOk)
|
||||
@@ -538,9 +538,9 @@ livoxGen1_detachDeviceCReq(
|
||||
// Add 5ms delay before destroying device
|
||||
|
||||
// Helper method to delay and then call destroyDeviceReq
|
||||
// Initialize timer with LivoxGen1 metadata io_service
|
||||
// Initialize timer with LivoxGen1 metadata io_context
|
||||
co_await adapters::boostAsio::getDeadlineTimerAReqAwaiter(
|
||||
requestComponentThread->getIoService(),
|
||||
requestComponentThread->getIoContext(),
|
||||
boost::posix_time::milliseconds(LIVOX_GEN1_DEVICE_COMMAND_DELAY_MS));
|
||||
|
||||
// No other buffers - stop and remove StimProducer
|
||||
|
||||
@@ -224,9 +224,9 @@ void OpenClCollatingAndMeshingEngine::finalize()
|
||||
*/
|
||||
int delayMs = std::max(OCLCOLLMESH_ENGN_FINALIZE_DELAY_MS, 0);
|
||||
|
||||
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 delayMs milliseconds to ensure that any in-flight OpenCL
|
||||
@@ -248,7 +248,7 @@ void OpenClCollatingAndMeshingEngine::finalize()
|
||||
bridge.setAsyncOperationComplete();
|
||||
});
|
||||
|
||||
bridge.waitForAsyncOperationCompleteOrIoServiceStopped();
|
||||
bridge.waitForAsyncOperationCompleteOrIoContextStopped();
|
||||
}
|
||||
|
||||
// Release OpenCL buffers via smo hooks
|
||||
@@ -317,10 +317,10 @@ void CL_CALLBACK OpenClCollatingAndMeshingEngine::compactKernelEventCallback(
|
||||
if (!engine || !engine->compactKernelCb)
|
||||
{ return; }
|
||||
|
||||
// Post to io_service to call callback on the correct thread
|
||||
// Post to io_context to call callback on the correct thread
|
||||
if (engine->parent.device && engine->parent.device->componentThread)
|
||||
{
|
||||
engine->parent.device->componentThread->getIoService().post(
|
||||
boost::asio::post(engine->parent.device->componentThread->getIoContext(),
|
||||
std::bind(engine->compactKernelCb, event_command_exec_status));
|
||||
}
|
||||
}
|
||||
@@ -335,10 +335,10 @@ void CL_CALLBACK OpenClCollatingAndMeshingEngine::collateKernelEventCallback(
|
||||
if (!engine || !engine->collateKernelCb)
|
||||
{ return; }
|
||||
|
||||
// Post to io_service to call callback on the correct thread
|
||||
// Post to io_context to call callback on the correct thread
|
||||
if (engine->parent.device && engine->parent.device->componentThread)
|
||||
{
|
||||
engine->parent.device->componentThread->getIoService().post(
|
||||
boost::asio::post(engine->parent.device->componentThread->getIoContext(),
|
||||
std::bind(engine->collateKernelCb, event_command_exec_status));
|
||||
}
|
||||
}
|
||||
@@ -1270,7 +1270,7 @@ void OpenClCollatingAndMeshingEngine::compactCollateAndMeshFrameReq(
|
||||
// Start with compaction if needed, then chain to collation
|
||||
if (needsCompaction)
|
||||
{
|
||||
parent.device->componentThread->getIoService().post(
|
||||
boost::asio::post(parent.device->componentThread->getIoContext(),
|
||||
STC(std::bind(
|
||||
&CompactCollateAndMeshFrameReq
|
||||
::compactCollateAndMeshFrameReq1_doCompact_posted,
|
||||
@@ -1279,7 +1279,7 @@ void OpenClCollatingAndMeshingEngine::compactCollateAndMeshFrameReq(
|
||||
else
|
||||
{
|
||||
// Skip compaction, go straight to collation
|
||||
parent.device->componentThread->getIoService().post(
|
||||
boost::asio::post(parent.device->componentThread->getIoContext(),
|
||||
STC(std::bind(
|
||||
&CompactCollateAndMeshFrameReq
|
||||
::compactCollateAndMeshFrameReq3_doCollate_posted,
|
||||
|
||||
@@ -114,7 +114,7 @@ PcloudStimulusProducer::PcloudStimulusProducer(
|
||||
size_t nDgramsPerStagingBufferFrame)
|
||||
: StimulusProducer(
|
||||
deviceAttachmentSpec,
|
||||
device->componentThread->getIoService()),
|
||||
device->componentThread->getIoContext()),
|
||||
nDgramsPerStagingBufferFrame(nDgramsPerStagingBufferFrame),
|
||||
device(device),
|
||||
formatDesc(formatDesc),
|
||||
@@ -764,7 +764,7 @@ void PcloudStimulusProducer::produceFrameReq(
|
||||
*this, caller, std::move(callback));
|
||||
|
||||
// Post the doAssemble method to the component thread
|
||||
device->componentThread->getIoService().post(
|
||||
boost::asio::post(device->componentThread->getIoContext(),
|
||||
STC(std::bind(
|
||||
&ProduceFrameReq::produceFrameReq1_doAssemble_posted,
|
||||
request.get(), request)));
|
||||
|
||||
Reference in New Issue
Block a user