Change io_service to io_context

This was renamed a while back in boost to be compliant with the
std::executors proposal.

Change-Id: Ib56544a0a7478990d18fe9e0bbbd8db1e52fa5b8
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp
index 2fc35e0..3f9089f 100644
--- a/src/ADCSensor.cpp
+++ b/src/ADCSensor.cpp
@@ -42,7 +42,7 @@
 ADCSensor::ADCSensor(const std::string& path,
                      sdbusplus::asio::object_server& objectServer,
                      std::shared_ptr<sdbusplus::asio::connection>& conn,
-                     boost::asio::io_service& io, const std::string& sensorName,
+                     boost::asio::io_context& io, const std::string& sensorName,
                      std::vector<thresholds::Threshold>&& thresholdsIn,
                      const double scaleFactor, const float pollRate,
                      PowerState readState,
diff --git a/src/ADCSensor.hpp b/src/ADCSensor.hpp
index 72fcd90..045a65e 100644
--- a/src/ADCSensor.hpp
+++ b/src/ADCSensor.hpp
@@ -69,7 +69,7 @@
     ADCSensor(const std::string& path,
               sdbusplus::asio::object_server& objectServer,
               std::shared_ptr<sdbusplus::asio::connection>& conn,
-              boost::asio::io_service& io, const std::string& sensorName,
+              boost::asio::io_context& io, const std::string& sensorName,
               std::vector<thresholds::Threshold>&& thresholds,
               double scaleFactor, float pollRate, PowerState readState,
               const std::string& sensorConfiguration,
diff --git a/src/ADCSensorMain.cpp b/src/ADCSensorMain.cpp
index f184d23..d7f1b2d 100644
--- a/src/ADCSensorMain.cpp
+++ b/src/ADCSensorMain.cpp
@@ -70,7 +70,7 @@
 }
 
 void createSensors(
-    boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+    boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
     boost::container::flat_map<std::string, std::shared_ptr<ADCSensor>>&
         sensors,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
@@ -298,7 +298,7 @@
 
 int main()
 {
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
     sdbusplus::asio::object_server objectServer(systemBus, true);
     objectServer.add_manager("/xyz/openbmc_project/sensors");
diff --git a/src/ChassisIntrusionSensor.cpp b/src/ChassisIntrusionSensor.cpp
index f7e7783..44ce3ac 100644
--- a/src/ChassisIntrusionSensor.cpp
+++ b/src/ChassisIntrusionSensor.cpp
@@ -20,7 +20,7 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <sdbusplus/asio/object_server.hpp>
 
 #include <cerrno>
@@ -361,7 +361,7 @@
 }
 
 ChassisIntrusionSensor::ChassisIntrusionSensor(
-    boost::asio::io_service& io,
+    boost::asio::io_context& io,
     std::shared_ptr<sdbusplus::asio::dbus_interface> iface) :
     mIface(std::move(iface)),
     mValue("unknown"), mOldValue("unknown"), mPollTimer(io), mGpioFd(io)
diff --git a/src/ChassisIntrusionSensor.hpp b/src/ChassisIntrusionSensor.hpp
index 8954033..be71e3f 100644
--- a/src/ChassisIntrusionSensor.hpp
+++ b/src/ChassisIntrusionSensor.hpp
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <boost/asio/steady_timer.hpp>
 #include <gpiod.hpp>
 #include <sdbusplus/asio/object_server.hpp>
@@ -18,7 +18,7 @@
 {
   public:
     ChassisIntrusionSensor(
-        boost::asio::io_service& io,
+        boost::asio::io_context& io,
         std::shared_ptr<sdbusplus::asio::dbus_interface> iface);
 
     ~ChassisIntrusionSensor();
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index d126def..8808ac8 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -931,7 +931,7 @@
 int main()
 {
 
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
     sdbusplus::asio::object_server objectServer(systemBus, true);
     objectServer.add_manager("/xyz/openbmc_project/sensors");
diff --git a/src/ExternalSensorMain.cpp b/src/ExternalSensorMain.cpp
index aa1e6b8..627a4f6 100644
--- a/src/ExternalSensorMain.cpp
+++ b/src/ExternalSensorMain.cpp
@@ -337,7 +337,7 @@
         std::cerr << "ExternalSensor service starting up\n";
     }
 
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
     sdbusplus::asio::object_server objectServer(systemBus, true);
 
diff --git a/src/FanMain.cpp b/src/FanMain.cpp
index 2c51396..2756213 100644
--- a/src/FanMain.cpp
+++ b/src/FanMain.cpp
@@ -227,7 +227,7 @@
 }
 
 void createSensors(
-    boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+    boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
     boost::container::flat_map<std::string, std::shared_ptr<TachSensor>>&
         tachSensors,
     boost::container::flat_map<std::string, std::unique_ptr<PwmSensor>>&
@@ -541,7 +541,7 @@
 
 int main()
 {
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
     sdbusplus::asio::object_server objectServer(systemBus, true);
 
diff --git a/src/HwmonTempMain.cpp b/src/HwmonTempMain.cpp
index 7ac03a3..28f191b 100644
--- a/src/HwmonTempMain.cpp
+++ b/src/HwmonTempMain.cpp
@@ -321,7 +321,7 @@
 }
 
 void createSensors(
-    boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+    boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
     boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>&
         sensors,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
@@ -625,7 +625,7 @@
     PowerState type, bool newState,
     boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>&
         sensors,
-    boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+    boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection)
 {
     if (newState)
@@ -646,7 +646,7 @@
 
 int main()
 {
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
     sdbusplus::asio::object_server objectServer(systemBus, true);
     objectServer.add_manager("/xyz/openbmc_project/sensors");
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index b4042ff..9fdbab1 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -44,7 +44,7 @@
     const std::string& path, const std::string& objectType,
     sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& conn,
-    boost::asio::io_service& io, const std::string& sensorName,
+    boost::asio::io_context& io, const std::string& sensorName,
     std::vector<thresholds::Threshold>&& thresholdsIn,
     const struct SensorParams& thisSensorParameters, const float pollRate,
     const std::string& sensorConfiguration, const PowerState powerState,
diff --git a/src/HwmonTempSensor.hpp b/src/HwmonTempSensor.hpp
index 27ffccd..d45dafd 100644
--- a/src/HwmonTempSensor.hpp
+++ b/src/HwmonTempSensor.hpp
@@ -28,7 +28,7 @@
     HwmonTempSensor(const std::string& path, const std::string& objectType,
                     sdbusplus::asio::object_server& objectServer,
                     std::shared_ptr<sdbusplus::asio::connection>& conn,
-                    boost::asio::io_service& io, const std::string& sensorName,
+                    boost::asio::io_context& io, const std::string& sensorName,
                     std::vector<thresholds::Threshold>&& thresholds,
                     const struct SensorParams& thisSensorParameters,
                     float pollRate, const std::string& sensorConfiguration,
diff --git a/src/IntelCPUSensor.cpp b/src/IntelCPUSensor.cpp
index 2995d60..9cd0409 100644
--- a/src/IntelCPUSensor.cpp
+++ b/src/IntelCPUSensor.cpp
@@ -38,7 +38,7 @@
     const std::string& path, const std::string& objectType,
     sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& conn,
-    boost::asio::io_service& io, const std::string& sensorName,
+    boost::asio::io_context& io, const std::string& sensorName,
     std::vector<thresholds::Threshold>&& thresholdsIn,
     const std::string& sensorConfiguration, int cpuId, bool show,
     double dtsOffset) :
diff --git a/src/IntelCPUSensor.hpp b/src/IntelCPUSensor.hpp
index 399e765..b23c0dc 100644
--- a/src/IntelCPUSensor.hpp
+++ b/src/IntelCPUSensor.hpp
@@ -25,7 +25,7 @@
     IntelCPUSensor(const std::string& path, const std::string& objectType,
                    sdbusplus::asio::object_server& objectServer,
                    std::shared_ptr<sdbusplus::asio::connection>& conn,
-                   boost::asio::io_service& io, const std::string& sensorName,
+                   boost::asio::io_context& io, const std::string& sensorName,
                    std::vector<thresholds::Threshold>&& thresholds,
                    const std::string& configuration, int cpuId, bool show,
                    double dtsOffset);
diff --git a/src/IntelCPUSensorMain.cpp b/src/IntelCPUSensorMain.cpp
index 10a45e8..f0b5f8c 100644
--- a/src/IntelCPUSensorMain.cpp
+++ b/src/IntelCPUSensorMain.cpp
@@ -93,7 +93,7 @@
 
 void detectCpuAsync(
     boost::asio::steady_timer& pingTimer,
-    boost::asio::steady_timer& creationTimer, boost::asio::io_service& io,
+    boost::asio::steady_timer& creationTimer, boost::asio::io_context& io,
     sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
     boost::container::flat_set<CPUConfig>& cpuConfigs,
@@ -129,7 +129,7 @@
     return sensorName;
 }
 
-bool createSensors(boost::asio::io_service& io,
+bool createSensors(boost::asio::io_context& io,
                    sdbusplus::asio::object_server& objectServer,
                    std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
                    boost::container::flat_set<CPUConfig>& cpuConfigs,
@@ -447,7 +447,7 @@
 
 void detectCpu(boost::asio::steady_timer& pingTimer,
                boost::asio::steady_timer& creationTimer,
-               boost::asio::io_service& io,
+               boost::asio::io_context& io,
                sdbusplus::asio::object_server& objectServer,
                std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
                boost::container::flat_set<CPUConfig>& cpuConfigs,
@@ -578,7 +578,7 @@
 
 void detectCpuAsync(
     boost::asio::steady_timer& pingTimer,
-    boost::asio::steady_timer& creationTimer, boost::asio::io_service& io,
+    boost::asio::steady_timer& creationTimer, boost::asio::io_context& io,
     sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
     boost::container::flat_set<CPUConfig>& cpuConfigs,
@@ -703,7 +703,7 @@
 
 int main()
 {
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
     boost::container::flat_set<CPUConfig> cpuConfigs;
 
diff --git a/src/IntrusionSensorMain.cpp b/src/IntrusionSensorMain.cpp
index fb8510c..cdb6551 100644
--- a/src/IntrusionSensorMain.cpp
+++ b/src/IntrusionSensorMain.cpp
@@ -17,7 +17,7 @@
 #include "ChassisIntrusionSensor.hpp"
 #include "Utils.hpp"
 
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <boost/container/flat_map.hpp>
 #include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/asio/connection.hpp>
@@ -418,7 +418,7 @@
     IntrusionSensorType type = IntrusionSensorType::gpio;
 
     // setup connection to dbus
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
 
     // setup object server, define interface
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index 9bc884e..b939ff1 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -59,7 +59,7 @@
 std::unique_ptr<boost::asio::steady_timer> initCmdTimer;
 
 IpmbSensor::IpmbSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
-                       boost::asio::io_service& io,
+                       boost::asio::io_context& io,
                        const std::string& sensorName,
                        const std::string& sensorConfiguration,
                        sdbusplus::asio::object_server& objectServer,
@@ -515,7 +515,7 @@
 }
 
 void createSensors(
-    boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+    boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
     boost::container::flat_map<std::string, std::shared_ptr<IpmbSensor>>&
         sensors,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection)
@@ -669,7 +669,7 @@
 int main()
 {
 
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
     sdbusplus::asio::object_server objectServer(systemBus, true);
     objectServer.add_manager("/xyz/openbmc_project/sensors");
diff --git a/src/IpmbSensor.hpp b/src/IpmbSensor.hpp
index 6467b57..bf94509 100644
--- a/src/IpmbSensor.hpp
+++ b/src/IpmbSensor.hpp
@@ -83,7 +83,7 @@
     public std::enable_shared_from_this<IpmbSensor>
 {
     IpmbSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
-               boost::asio::io_service& io, const std::string& name,
+               boost::asio::io_context& io, const std::string& name,
                const std::string& sensorConfiguration,
                sdbusplus::asio::object_server& objectServer,
                std::vector<thresholds::Threshold>&& thresholdData,
diff --git a/src/MCUTempSensor.cpp b/src/MCUTempSensor.cpp
index a5d964d..cf38521 100644
--- a/src/MCUTempSensor.cpp
+++ b/src/MCUTempSensor.cpp
@@ -49,7 +49,7 @@
 boost::container::flat_map<std::string, std::unique_ptr<MCUTempSensor>> sensors;
 
 MCUTempSensor::MCUTempSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
-                             boost::asio::io_service& io,
+                             boost::asio::io_context& io,
                              const std::string& sensorName,
                              const std::string& sensorConfiguration,
                              sdbusplus::asio::object_server& objectServer,
@@ -188,7 +188,7 @@
 }
 
 void createSensors(
-    boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+    boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
     boost::container::flat_map<std::string, std::unique_ptr<MCUTempSensor>>&
         sensors,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection)
@@ -259,7 +259,7 @@
 
 int main()
 {
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
     sdbusplus::asio::object_server objectServer(systemBus, true);
     objectServer.add_manager("/xyz/openbmc_project/sensors");
diff --git a/src/MCUTempSensor.hpp b/src/MCUTempSensor.hpp
index c4c2406..639e24e 100644
--- a/src/MCUTempSensor.hpp
+++ b/src/MCUTempSensor.hpp
@@ -12,7 +12,7 @@
 struct MCUTempSensor : public Sensor
 {
     MCUTempSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
-                  boost::asio::io_service& io, const std::string& name,
+                  boost::asio::io_context& io, const std::string& name,
                   const std::string& sensorConfiguration,
                   sdbusplus::asio::object_server& objectServer,
                   std::vector<thresholds::Threshold>&& thresholdData,
diff --git a/src/NVMeBasicContext.cpp b/src/NVMeBasicContext.cpp
index b4599c7..3bf315a 100644
--- a/src/NVMeBasicContext.cpp
+++ b/src/NVMeBasicContext.cpp
@@ -185,7 +185,7 @@
 
 /* Throws std::error_code on failure */
 /* FIXME: Probably shouldn't do fallible stuff in a constructor */
-NVMeBasicContext::NVMeBasicContext(boost::asio::io_service& io, int rootBus) :
+NVMeBasicContext::NVMeBasicContext(boost::asio::io_context& io, int rootBus) :
     NVMeContext::NVMeContext(io, rootBus), io(io), reqStream(io), respStream(io)
 {
     std::array<int, 2> responsePipe{};
diff --git a/src/NVMeBasicContext.hpp b/src/NVMeBasicContext.hpp
index b17fc05..52b6a09 100644
--- a/src/NVMeBasicContext.hpp
+++ b/src/NVMeBasicContext.hpp
@@ -2,7 +2,7 @@
 
 #include "NVMeContext.hpp"
 
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <boost/asio/posix/stream_descriptor.hpp>
 
 #include <thread>
@@ -10,7 +10,7 @@
 class NVMeBasicContext : public NVMeContext
 {
   public:
-    NVMeBasicContext(boost::asio::io_service& io, int rootBus);
+    NVMeBasicContext(boost::asio::io_context& io, int rootBus);
     ~NVMeBasicContext() override = default;
     void pollNVMeDevices() override;
     void readAndProcessNVMeSensor() override;
@@ -18,9 +18,9 @@
                          size_t len) override;
 
   private:
-    NVMeBasicContext(boost::asio::io_service& io, int rootBus, int cmdOut,
+    NVMeBasicContext(boost::asio::io_context& io, int rootBus, int cmdOut,
                      int streamIn, int streamOut, int cmdIn);
-    boost::asio::io_service& io;
+    boost::asio::io_context& io;
 
     // The IO thread must be destructed after the stream descriptors, so
     // initialise it first. http://eel.is/c++draft/class.base.init#note-6
diff --git a/src/NVMeContext.hpp b/src/NVMeContext.hpp
index bcfa5d6..14e38a1 100644
--- a/src/NVMeContext.hpp
+++ b/src/NVMeContext.hpp
@@ -2,7 +2,7 @@
 
 #include "NVMeSensor.hpp"
 
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <boost/asio/steady_timer.hpp>
 
 #include <memory>
@@ -11,7 +11,7 @@
 class NVMeContext : public std::enable_shared_from_this<NVMeContext>
 {
   public:
-    NVMeContext(boost::asio::io_service& io, int rootBus) :
+    NVMeContext(boost::asio::io_context& io, int rootBus) :
         scanTimer(io), rootBus(rootBus), pollCursor(sensors.end())
     {
         if (rootBus < 0)
diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp
index 4301158..e11fae7 100644
--- a/src/NVMeSensor.cpp
+++ b/src/NVMeSensor.cpp
@@ -22,7 +22,7 @@
 static constexpr double minReading = 0;
 
 NVMeSensor::NVMeSensor(sdbusplus::asio::object_server& objectServer,
-                       boost::asio::io_service& /*unused*/,
+                       boost::asio::io_context& /*unused*/,
                        std::shared_ptr<sdbusplus::asio::connection>& conn,
                        const std::string& sensorName,
                        std::vector<thresholds::Threshold>&& thresholdsIn,
diff --git a/src/NVMeSensor.hpp b/src/NVMeSensor.hpp
index 4e0000f..dfed215 100644
--- a/src/NVMeSensor.hpp
+++ b/src/NVMeSensor.hpp
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <sensor.hpp>
 
 class NVMeSensor : public Sensor
@@ -9,7 +9,7 @@
     static constexpr const char* sensorType = "NVME1000";
 
     NVMeSensor(sdbusplus::asio::object_server& objectServer,
-               boost::asio::io_service& io,
+               boost::asio::io_context& io,
                std::shared_ptr<sdbusplus::asio::connection>& conn,
                const std::string& sensorName,
                std::vector<thresholds::Threshold>&& thresholds,
diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp
index 9ad0706..f331747 100644
--- a/src/NVMeSensorMain.cpp
+++ b/src/NVMeSensorMain.cpp
@@ -91,7 +91,7 @@
 }
 
 static std::shared_ptr<NVMeContext>
-    provideRootBusContext(boost::asio::io_service& io, NVMEMap& map,
+    provideRootBusContext(boost::asio::io_context& io, NVMEMap& map,
                           int rootBus)
 {
     auto findRoot = map.find(rootBus);
@@ -108,7 +108,7 @@
 }
 
 static void handleSensorConfigurations(
-    boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+    boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
     const ManagedObjectType& sensorConfigurations)
 {
@@ -180,7 +180,7 @@
     }
 }
 
-void createSensors(boost::asio::io_service& io,
+void createSensors(boost::asio::io_context& io,
                    sdbusplus::asio::object_server& objectServer,
                    std::shared_ptr<sdbusplus::asio::connection>& dbusConnection)
 {
@@ -229,7 +229,7 @@
 
 int main()
 {
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
     systemBus->request_name("xyz.openbmc_project.NVMeSensor");
     sdbusplus::asio::object_server objectServer(systemBus, true);
diff --git a/src/PSUEvent.cpp b/src/PSUEvent.cpp
index ce8301e..1dd98ca 100644
--- a/src/PSUEvent.cpp
+++ b/src/PSUEvent.cpp
@@ -18,7 +18,7 @@
 
 #include "SensorPaths.hpp"
 
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <boost/asio/read_until.hpp>
 #include <boost/container/flat_map.hpp>
 #include <phosphor-logging/lg2.hpp>
@@ -36,7 +36,7 @@
 PSUCombineEvent::PSUCombineEvent(
     sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& conn,
-    boost::asio::io_service& io, const std::string& psuName,
+    boost::asio::io_context& io, const std::string& psuName,
     const PowerState& powerState,
     boost::container::flat_map<std::string, std::vector<std::string>>&
         eventPathList,
@@ -140,7 +140,7 @@
 PSUSubEvent::PSUSubEvent(
     std::shared_ptr<sdbusplus::asio::dbus_interface> eventInterface,
     const std::string& path, std::shared_ptr<sdbusplus::asio::connection>& conn,
-    boost::asio::io_service& io, const PowerState& powerState,
+    boost::asio::io_context& io, const PowerState& powerState,
     const std::string& groupEventName, const std::string& eventName,
     std::shared_ptr<std::set<std::string>> asserts,
     std::shared_ptr<std::set<std::string>> combineEvent,
diff --git a/src/PSUEvent.hpp b/src/PSUEvent.hpp
index 12fc2ef..3e066cf 100644
--- a/src/PSUEvent.hpp
+++ b/src/PSUEvent.hpp
@@ -18,7 +18,7 @@
 
 #include "Utils.hpp"
 
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <boost/asio/random_access_file.hpp>
 #include <boost/asio/steady_timer.hpp>
 #include <boost/container/flat_map.hpp>
@@ -36,7 +36,7 @@
     PSUSubEvent(std::shared_ptr<sdbusplus::asio::dbus_interface> eventInterface,
                 const std::string& path,
                 std::shared_ptr<sdbusplus::asio::connection>& conn,
-                boost::asio::io_service& io, const PowerState& powerState,
+                boost::asio::io_context& io, const PowerState& powerState,
                 const std::string& groupEventName, const std::string& eventName,
                 std::shared_ptr<std::set<std::string>> asserts,
                 std::shared_ptr<std::set<std::string>> combineEvent,
@@ -81,7 +81,7 @@
     PSUCombineEvent(
         sdbusplus::asio::object_server& objectServer,
         std::shared_ptr<sdbusplus::asio::connection>& conn,
-        boost::asio::io_service& io, const std::string& psuName,
+        boost::asio::io_context& io, const std::string& psuName,
         const PowerState& powerState,
         boost::container::flat_map<std::string, std::vector<std::string>>&
             eventPathList,
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index 986fe59..049ae5c 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -38,7 +38,7 @@
 PSUSensor::PSUSensor(const std::string& path, const std::string& objectType,
                      sdbusplus::asio::object_server& objectServer,
                      std::shared_ptr<sdbusplus::asio::connection>& conn,
-                     boost::asio::io_service& io, const std::string& sensorName,
+                     boost::asio::io_context& io, const std::string& sensorName,
                      std::vector<thresholds::Threshold>&& thresholdsIn,
                      const std::string& sensorConfiguration,
                      const PowerState& powerState,
diff --git a/src/PSUSensor.hpp b/src/PSUSensor.hpp
index 379b9d9..49e181e 100644
--- a/src/PSUSensor.hpp
+++ b/src/PSUSensor.hpp
@@ -18,7 +18,7 @@
     PSUSensor(const std::string& path, const std::string& objectType,
               sdbusplus::asio::object_server& objectServer,
               std::shared_ptr<sdbusplus::asio::connection>& conn,
-              boost::asio::io_service& io, const std::string& sensorName,
+              boost::asio::io_context& io, const std::string& sensorName,
               std::vector<thresholds::Threshold>&& thresholds,
               const std::string& sensorConfiguration,
               const PowerState& powerState, const std::string& sensorUnits,
diff --git a/src/PSUSensorMain.cpp b/src/PSUSensorMain.cpp
index b7067e4..a9db462 100644
--- a/src/PSUSensorMain.cpp
+++ b/src/PSUSensorMain.cpp
@@ -283,7 +283,7 @@
 }
 
 static void createSensorsCallback(
-    boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+    boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
     const ManagedObjectType& sensorConfigs,
     const std::shared_ptr<boost::container::flat_set<std::string>>&
@@ -913,7 +913,7 @@
 }
 
 void createSensors(
-    boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+    boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
     const std::shared_ptr<boost::container::flat_set<std::string>>&
         sensorsChanged)
@@ -1047,7 +1047,7 @@
 
 int main()
 {
-    boost::asio::io_service io;
+    boost::asio::io_context io;
     auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
 
     sdbusplus::asio::object_server objectServer(systemBus, true);
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index 9a1ff7c..0462186 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -44,7 +44,7 @@
                        std::shared_ptr<sdbusplus::asio::connection>& conn,
                        std::unique_ptr<PresenceSensor>&& presenceSensor,
                        std::optional<RedundancySensor>* redundancy,
-                       boost::asio::io_service& io, const std::string& fanName,
+                       boost::asio::io_context& io, const std::string& fanName,
                        std::vector<thresholds::Threshold>&& thresholdsIn,
                        const std::string& sensorConfiguration,
                        const std::pair<double, double>& limits,
@@ -210,7 +210,7 @@
 }
 
 PresenceSensor::PresenceSensor(const std::string& gpioName, bool inverted,
-                               boost::asio::io_service& io,
+                               boost::asio::io_context& io,
                                const std::string& name) :
     gpioLine(gpiod::find_line(gpioName)),
     gpioFd(io), name(name)
diff --git a/src/TachSensor.hpp b/src/TachSensor.hpp
index 92c5202..b53b5ae 100644
--- a/src/TachSensor.hpp
+++ b/src/TachSensor.hpp
@@ -20,7 +20,7 @@
 {
   public:
     PresenceSensor(const std::string& gpioName, bool inverted,
-                   boost::asio::io_service& io, const std::string& name);
+                   boost::asio::io_context& io, const std::string& name);
     ~PresenceSensor();
 
     void monitorPresence(void);
@@ -70,7 +70,7 @@
                std::shared_ptr<sdbusplus::asio::connection>& conn,
                std::unique_ptr<PresenceSensor>&& presence,
                std::optional<RedundancySensor>* redundancy,
-               boost::asio::io_service& io, const std::string& fanName,
+               boost::asio::io_context& io, const std::string& fanName,
                std::vector<thresholds::Threshold>&& thresholds,
                const std::string& sensorConfiguration,
                const std::pair<double, double>& limits,
diff --git a/src/Thresholds.hpp b/src/Thresholds.hpp
index cd89efc..a89c1dc 100644
--- a/src/Thresholds.hpp
+++ b/src/Thresholds.hpp
@@ -2,7 +2,7 @@
 
 #include "Utils.hpp"
 
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <boost/asio/steady_timer.hpp>
 #include <nlohmann/json.hpp>
 
@@ -69,7 +69,7 @@
 struct ThresholdTimer
 {
 
-    explicit ThresholdTimer(boost::asio::io_service& ioService) : io(ioService)
+    explicit ThresholdTimer(boost::asio::io_context& ioService) : io(ioService)
     {}
 
     bool hasActiveTimer(const Threshold& threshold, bool assert)
@@ -111,7 +111,7 @@
                     const Threshold& threshold, bool assert,
                     double assertValue);
 
-    boost::asio::io_service& io;
+    boost::asio::io_context& io;
     std::list<TimerPair> timers;
 };