[ndnSIM] core: Make use of scheduler redirection from ndn-cxx library (avoid code duplication)
Change-Id: I238dff4f25f07cdd05f96714c3dbeca01327c26d
diff --git a/core/global-io.hpp b/core/global-io.hpp
index ef90b18..6a76c57 100644
--- a/core/global-io.hpp
+++ b/core/global-io.hpp
@@ -29,25 +29,27 @@
namespace nfd {
-/** \return *nullptr (kept for interface compatibility)
- */
-inline boost::asio::io_service&
-getGlobalIoService()
-{
- return *static_cast<boost::asio::io_service*>(nullptr);
-}
+namespace detail {
-#ifdef WITH_TESTS
-/** \brief delete the global io_service instance
- *
- * It will be recreated at the next invocation of getGlobalIoService.
+/**
+ * @brief Simulator-based IO that implements a few interfaces from boost::asio::io_service
*/
-inline void
-resetGlobalIoService()
+class SimulatorIo
{
- // noop
-}
-#endif
+public:
+ void
+ post(const std::function<void()>& callback);
+
+ void
+ dispatch(const std::function<void()>& callback);
+};
+
+} // namespace detail
+
+/** \return Simulator-based IO object
+ */
+detail::SimulatorIo&
+getGlobalIoService();
} // namespace nfd