Boost.ASIO: upgrade io_service=>io_context, finally
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user