Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
upgrade default ASIO version to 1-12-2 and migrate to new names for i…
Browse files Browse the repository at this point in the history
…o_context (previously io_service) and asio::io_context::string (previously asio::strand)
  • Loading branch information
jadamcrain committed May 20, 2019
1 parent 56b2372 commit d7326f0
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cpp/libs/include/asiopal/Executor.h
Expand Up @@ -81,7 +81,7 @@ class Executor final :
return Create(this->io);
}

asio::strand strand;
asio::io_context::strand strand;

private:

Expand Down
4 changes: 2 additions & 2 deletions cpp/libs/include/asiopal/IO.h
Expand Up @@ -27,7 +27,7 @@ namespace asiopal
{

/**
* Container class for an asio::io_service
* Container class for an asio::io_context
*/
class IO
{
Expand All @@ -36,7 +36,7 @@ class IO

virtual ~IO() {}

asio::io_service service;
asio::io_context service;

};

Expand Down
2 changes: 1 addition & 1 deletion cpp/libs/include/asiopal/SerialChannel.h
Expand Up @@ -50,7 +50,7 @@ class SerialChannel final : public IAsyncChannel
virtual void BeginWriteImpl(const openpal::RSlice& buffer) override;
virtual void ShutdownImpl() override;

asio::basic_serial_port<> port;
asio::serial_port port;

};

Expand Down
2 changes: 1 addition & 1 deletion cpp/libs/include/asiopal/ThreadPool.h
Expand Up @@ -34,7 +34,7 @@ namespace asiopal
{

/**
* A thread pool that calls asio::io_service::run
* A thread pool that calls asio::io_context::run
*/
class ThreadPool
{
Expand Down
2 changes: 1 addition & 1 deletion cpp/libs/include/asiopal/Timer.h
Expand Up @@ -43,7 +43,7 @@ class Timer final : public openpal::ITimer, private openpal::Uncopyable

public:

Timer(asio::io_service& service);
Timer(asio::io_context& service);

virtual void Cancel() override;

Expand Down
2 changes: 1 addition & 1 deletion cpp/libs/src/asiopal/Executor.cpp
Expand Up @@ -59,7 +59,7 @@ ITimer* Executor::Start(const MonotonicTimestamp& time, const action_t& runnable

openpal::ITimer* Executor::Start(const steady_clock_t::time_point& expiration, const openpal::action_t& runnable)
{
auto timer = std::make_shared<Timer>(this->strand.get_io_service());
auto timer = std::make_shared<Timer>(this->strand.get_io_context());

timer->timer.expires_at(expiration);

Expand Down
2 changes: 1 addition & 1 deletion cpp/libs/src/asiopal/SerialChannel.cpp
Expand Up @@ -31,7 +31,7 @@
namespace asiopal
{

SerialChannel::SerialChannel(std::shared_ptr<Executor> executor) : IAsyncChannel(executor), port(executor->strand.get_io_service())
SerialChannel::SerialChannel(std::shared_ptr<Executor> executor) : IAsyncChannel(executor), port(executor->strand.get_io_context())
{}

bool SerialChannel::Open(const SerialSettings& settings, std::error_code& ec)
Expand Down
4 changes: 2 additions & 2 deletions cpp/libs/src/asiopal/TCPClient.cpp
Expand Up @@ -34,9 +34,9 @@ TCPClient::TCPClient(
condition(logger),
executor(executor),
adapter(adapter),
socket(executor->strand.get_io_service()),
socket(executor->strand.get_io_context()),
localEndpoint(),
resolver(executor->strand.get_io_service())
resolver(executor->strand.get_io_context())
{}


Expand Down
4 changes: 2 additions & 2 deletions cpp/libs/src/asiopal/TCPServer.cpp
Expand Up @@ -41,8 +41,8 @@ TCPServer::TCPServer(
logger(logger),
executor(executor),
endpoint(ip::tcp::v4(), endpoint.port),
acceptor(executor->strand.get_io_service()),
socket(executor->strand.get_io_service())
acceptor(executor->strand.get_io_context()),
socket(executor->strand.get_io_context())
{
this->Configure(endpoint.address, ec);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/libs/src/asiopal/Timer.cpp
Expand Up @@ -39,7 +39,7 @@ MonotonicTimestamp Timer::ExpiresAt()
return MonotonicTimestamp(millisec);
}

Timer::Timer(asio::io_service& service) : timer(service)
Timer::Timer(asio::io_context& service) : timer(service)
{}

}
Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/asiopal/src/TestASIO.cpp
Expand Up @@ -49,7 +49,7 @@ TEST_CASE(SUITE("TimerCancel"))
{
bool flag = false;

io_service io;
io_context io;
steady_timer t1(io, std::chrono::seconds(0));
steady_timer t2(io, std::chrono::seconds(1));

Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/asiopal/src/mocks/MockIO.cpp
Expand Up @@ -26,7 +26,7 @@
namespace asiopal
{

MockIO::Timeout::Timeout(asio::io_service& service, std::chrono::steady_clock::duration timeout) :
MockIO::Timeout::Timeout(asio::io_context& service, std::chrono::steady_clock::duration timeout) :
timer(std::make_shared<asio::basic_waitable_timer<std::chrono::steady_clock>>(service, timeout))
{
auto callback = [t = timer](const std::error_code & ec)
Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/asiopal/src/mocks/MockIO.h
Expand Up @@ -36,7 +36,7 @@ class MockIO final : public IO, public std::enable_shared_from_this<MockIO>

public:

Timeout(asio::io_service& service, std::chrono::steady_clock::duration timeout);
Timeout(asio::io_context& service, std::chrono::steady_clock::duration timeout);

~Timeout();

Expand Down
2 changes: 1 addition & 1 deletion deps/asio
Submodule asio updated 1039 files

0 comments on commit d7326f0

Please sign in to comment.