build: require boost >= 1.71.0
Refs: #5276
Change-Id: Ie428541639dcf1113acfb9e9d0a80f9be87d6cd3
diff --git a/daemon/common/global.cpp b/daemon/common/global.cpp
index c54f043..a9848cd 100644
--- a/daemon/common/global.cpp
+++ b/daemon/common/global.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,18 +27,18 @@
namespace nfd {
-static thread_local unique_ptr<boost::asio::io_service> g_ioService;
+static thread_local unique_ptr<boost::asio::io_context> g_ioCtx;
static thread_local unique_ptr<Scheduler> g_scheduler;
-static boost::asio::io_service* g_mainIoService = nullptr;
-static boost::asio::io_service* g_ribIoService = nullptr;
+static boost::asio::io_context* g_mainIoCtx = nullptr;
+static boost::asio::io_context* g_ribIoCtx = nullptr;
-boost::asio::io_service&
+boost::asio::io_context&
getGlobalIoService()
{
- if (g_ioService == nullptr) {
- g_ioService = make_unique<boost::asio::io_service>();
+ if (g_ioCtx == nullptr) {
+ g_ioCtx = make_unique<boost::asio::io_context>();
}
- return *g_ioService;
+ return *g_ioCtx;
}
Scheduler&
@@ -55,46 +55,34 @@
resetGlobalIoService()
{
g_scheduler.reset();
- g_ioService.reset();
+ g_ioCtx.reset();
}
#endif
-boost::asio::io_service&
+boost::asio::io_context&
getMainIoService()
{
- BOOST_ASSERT(g_mainIoService != nullptr);
- return *g_mainIoService;
+ BOOST_ASSERT(g_mainIoCtx != nullptr);
+ return *g_mainIoCtx;
}
-boost::asio::io_service&
+boost::asio::io_context&
getRibIoService()
{
- BOOST_ASSERT(g_ribIoService != nullptr);
- return *g_ribIoService;
+ BOOST_ASSERT(g_ribIoCtx != nullptr);
+ return *g_ribIoCtx;
}
void
-setMainIoService(boost::asio::io_service* mainIo)
+setMainIoService(boost::asio::io_context* mainIo)
{
- g_mainIoService = mainIo;
+ g_mainIoCtx = mainIo;
}
void
-setRibIoService(boost::asio::io_service* ribIo)
+setRibIoService(boost::asio::io_context* ribIo)
{
- g_ribIoService = ribIo;
-}
-
-void
-runOnMainIoService(const std::function<void()>& f)
-{
- getMainIoService().post(f);
-}
-
-void
-runOnRibIoService(const std::function<void()>& f)
-{
- getRibIoService().post(f);
+ g_ribIoCtx = ribIo;
}
} // namespace nfd
diff --git a/daemon/common/global.hpp b/daemon/common/global.hpp
index 25102f9..3ee072d 100644
--- a/daemon/common/global.hpp
+++ b/daemon/common/global.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022 Regents of the University of California,
+ * Copyright (c) 2014-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,46 +27,39 @@
#include "core/common.hpp"
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
namespace nfd {
-/** \brief Returns the global io_service instance for the calling thread.
+/**
+ * \brief Returns the global io_context instance for the calling thread.
*/
-boost::asio::io_service&
+boost::asio::io_context&
getGlobalIoService();
-/** \brief Returns the global Scheduler instance for the calling thread.
+/**
+ * \brief Returns the global Scheduler instance for the calling thread.
*/
Scheduler&
getScheduler();
-boost::asio::io_service&
+boost::asio::io_context&
getMainIoService();
-boost::asio::io_service&
+boost::asio::io_context&
getRibIoService();
void
-setMainIoService(boost::asio::io_service* mainIo);
+setMainIoService(boost::asio::io_context* mainIo);
void
-setRibIoService(boost::asio::io_service* ribIo);
-
-/** \brief Run a function on the main io_service instance.
- */
-void
-runOnMainIoService(const std::function<void()>& f);
-
-/** \brief Run a function on the RIB io_service instance.
- */
-void
-runOnRibIoService(const std::function<void()>& f);
+setRibIoService(boost::asio::io_context* ribIo);
#ifdef NFD_WITH_TESTS
-/** \brief Destroy the global io_service instance.
+/**
+ * \brief Destroy the global io_context instance.
*
- * It will be recreated at the next invocation of getGlobalIoService().
+ * It will be recreated at the next invocation of getGlobalIoService().
*/
void
resetGlobalIoService();