core+daemon: eliminate scheduler::{schedule,cancel} wrappers

Also move core/global-io.hpp to daemon/global.hpp

Refs: #4528, #4883
Change-Id: I0b99029f1a19d7451aab57099cd3303b7eb42ff3
diff --git a/daemon/face/datagram-transport.hpp b/daemon/face/datagram-transport.hpp
index 501b590..135035f 100644
--- a/daemon/face/datagram-transport.hpp
+++ b/daemon/face/datagram-transport.hpp
@@ -28,7 +28,7 @@
 
 #include "transport.hpp"
 #include "socket-utils.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 #include <array>
 
diff --git a/daemon/face/ethernet-channel.cpp b/daemon/face/ethernet-channel.cpp
index 21949b3..4b5a072 100644
--- a/daemon/face/ethernet-channel.cpp
+++ b/daemon/face/ethernet-channel.cpp
@@ -27,7 +27,7 @@
 #include "ethernet-protocol.hpp"
 #include "generic-link-service.hpp"
 #include "unicast-ethernet-transport.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 #include <boost/range/adaptor/map.hpp>
 #include <pcap/pcap.h>
diff --git a/daemon/face/ethernet-transport.cpp b/daemon/face/ethernet-transport.cpp
index ee7193b..0e69745 100644
--- a/daemon/face/ethernet-transport.cpp
+++ b/daemon/face/ethernet-transport.cpp
@@ -25,7 +25,7 @@
 
 #include "ethernet-transport.hpp"
 #include "ethernet-protocol.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 #include <pcap/pcap.h>
 
diff --git a/daemon/face/face-system.cpp b/daemon/face/face-system.cpp
index 21685f3..260eea7 100644
--- a/daemon/face/face-system.cpp
+++ b/daemon/face/face-system.cpp
@@ -26,7 +26,7 @@
 #include "face-system.hpp"
 #include "protocol-factory.hpp"
 #include "netdev-bound.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 #include "fw/face-table.hpp"
 
 namespace nfd {
diff --git a/daemon/face/internal-face.cpp b/daemon/face/internal-face.cpp
index 8bea03d..f82bd58 100644
--- a/daemon/face/internal-face.cpp
+++ b/daemon/face/internal-face.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,7 +26,7 @@
 #include "internal-face.hpp"
 #include "generic-link-service.hpp"
 #include "internal-transport.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace face {
diff --git a/daemon/face/internal-transport.cpp b/daemon/face/internal-transport.cpp
index 7e7ac3e..5c59ad7 100644
--- a/daemon/face/internal-transport.cpp
+++ b/daemon/face/internal-transport.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,7 +24,7 @@
  */
 
 #include "internal-transport.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace face {
diff --git a/daemon/face/lp-reassembler.cpp b/daemon/face/lp-reassembler.cpp
index 905dc66..918d296 100644
--- a/daemon/face/lp-reassembler.cpp
+++ b/daemon/face/lp-reassembler.cpp
@@ -25,6 +25,7 @@
 
 #include "lp-reassembler.hpp"
 #include "link-service.hpp"
+#include "daemon/global.hpp"
 
 #include <numeric>
 
@@ -113,7 +114,7 @@
   }
 
   // set drop timer
-  pp.dropTimer = scheduler::schedule(m_options.reassemblyTimeout, [=] { timeoutPartialPacket(key); });
+  pp.dropTimer = getScheduler().schedule(m_options.reassemblyTimeout, [=] { timeoutPartialPacket(key); });
 
   return FALSE_RETURN;
 }
diff --git a/daemon/face/lp-reassembler.hpp b/daemon/face/lp-reassembler.hpp
index 21f4e1c..2c5ff91 100644
--- a/daemon/face/lp-reassembler.hpp
+++ b/daemon/face/lp-reassembler.hpp
@@ -26,7 +26,6 @@
 #ifndef NFD_DAEMON_FACE_LP_REASSEMBLER_HPP
 #define NFD_DAEMON_FACE_LP_REASSEMBLER_HPP
 
-#include "core/scheduler.hpp"
 #include "face-log.hpp"
 #include "transport.hpp"
 
@@ -125,8 +124,8 @@
 
 private:
   Options m_options;
-  std::map<Key, PartialPacket> m_partialPackets;
   const LinkService* m_linkService;
+  std::map<Key, PartialPacket> m_partialPackets;
 };
 
 std::ostream&
diff --git a/daemon/face/lp-reliability.cpp b/daemon/face/lp-reliability.cpp
index d46356b..f65d3c3 100644
--- a/daemon/face/lp-reliability.cpp
+++ b/daemon/face/lp-reliability.cpp
@@ -26,6 +26,7 @@
 #include "lp-reliability.hpp"
 #include "generic-link-service.hpp"
 #include "transport.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace face {
@@ -38,7 +39,6 @@
   , m_isIdleAckTimerRunning(false)
 {
   BOOST_ASSERT(m_linkService != nullptr);
-
   BOOST_ASSERT(m_options.idleAckTimerPeriod > 0_ns);
 }
 
@@ -81,7 +81,8 @@
                                                  std::forward_as_tuple(txSeq),
                                                  std::forward_as_tuple(frag));
     unackedFragsIt->second.sendTime = sendTime;
-    unackedFragsIt->second.rtoTimer = scheduler::schedule(m_rto.computeRto(), [=] { onLpPacketLost(txSeq); });
+    unackedFragsIt->second.rtoTimer = getScheduler().schedule(m_rto.computeRto(),
+                                                              [=] { onLpPacketLost(txSeq); });
     unackedFragsIt->second.netPkt = netPkt;
 
     if (m_unackedFrags.size() == 1) {
@@ -199,7 +200,7 @@
   BOOST_ASSERT(!m_isIdleAckTimerRunning);
   m_isIdleAckTimerRunning = true;
 
-  m_idleAckTimer = scheduler::schedule(m_options.idleAckTimerPeriod, [this] {
+  m_idleAckTimer = getScheduler().schedule(m_options.idleAckTimerPeriod, [this] {
     while (!m_ackQueue.empty()) {
       m_linkService->requestIdlePacket();
     }
@@ -304,7 +305,7 @@
     m_linkService->sendLpPacket(lp::Packet(newTxFrag.pkt));
 
     // Start RTO timer for this sequence
-    newTxFrag.rtoTimer = scheduler::schedule(m_rto.computeRto(), [=] { onLpPacketLost(newTxSeq); });
+    newTxFrag.rtoTimer = getScheduler().schedule(m_rto.computeRto(), [=] { onLpPacketLost(newTxSeq); });
   }
 
   return removedThisTxSeq;
diff --git a/daemon/face/lp-reliability.hpp b/daemon/face/lp-reliability.hpp
index 9521183..5018730 100644
--- a/daemon/face/lp-reliability.hpp
+++ b/daemon/face/lp-reliability.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_FACE_LP_RELIABILITY_HPP
 
 #include "core/rtt-estimator.hpp"
-#include "core/scheduler.hpp"
 
 #include <ndn-cxx/lp/packet.hpp>
 #include <ndn-cxx/lp/sequence.hpp>
diff --git a/daemon/face/multicast-ethernet-transport.cpp b/daemon/face/multicast-ethernet-transport.cpp
index 2afb793..f0fa5ce 100644
--- a/daemon/face/multicast-ethernet-transport.cpp
+++ b/daemon/face/multicast-ethernet-transport.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "multicast-ethernet-transport.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 #include <cerrno>         // for errno
 #include <cstring>        // for memcpy(), strerror(), strncpy()
diff --git a/daemon/face/stream-transport.hpp b/daemon/face/stream-transport.hpp
index 9daf29e..eb7de92 100644
--- a/daemon/face/stream-transport.hpp
+++ b/daemon/face/stream-transport.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,7 +28,7 @@
 
 #include "transport.hpp"
 #include "socket-utils.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 #include <queue>
 
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index 639b27d..54a620c 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,9 +24,9 @@
  */
 
 #include "tcp-channel.hpp"
-#include "core/global-io.hpp"
 #include "generic-link-service.hpp"
 #include "tcp-transport.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace face {
@@ -84,7 +84,7 @@
   }
 
   auto clientSocket = make_shared<ip::tcp::socket>(std::ref(getGlobalIoService()));
-  auto timeoutEvent = scheduler::schedule(timeout, [=] {
+  auto timeoutEvent = getScheduler().schedule(timeout, [=] {
     handleConnectTimeout(remoteEndpoint, clientSocket, onConnectFailed);
   });
 
@@ -187,7 +187,7 @@
                           const FaceCreatedCallback& onFaceCreated,
                           const FaceCreationFailedCallback& onConnectFailed)
 {
-  scheduler::cancel(connectTimeoutEvent);
+  connectTimeoutEvent.cancel();
 
   if (error) {
     if (error != boost::asio::error::operation_aborted) {
diff --git a/daemon/face/tcp-channel.hpp b/daemon/face/tcp-channel.hpp
index c840695..cb41b2c 100644
--- a/daemon/face/tcp-channel.hpp
+++ b/daemon/face/tcp-channel.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_FACE_TCP_CHANNEL_HPP
 
 #include "channel.hpp"
-#include "core/scheduler.hpp"
 
 namespace nfd {
 
diff --git a/daemon/face/tcp-transport.cpp b/daemon/face/tcp-transport.cpp
index 78d7097..4c747be 100644
--- a/daemon/face/tcp-transport.cpp
+++ b/daemon/face/tcp-transport.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,6 +24,7 @@
  */
 
 #include "tcp-transport.hpp"
+#include "daemon/global.hpp"
 
 #if defined(__linux__)
 #include <linux/sockios.h>
@@ -39,7 +40,9 @@
 time::milliseconds TcpTransport::s_maxReconnectWait = 5_min;
 float TcpTransport::s_reconnectWaitMultiplier = 2.0f;
 
-TcpTransport::TcpTransport(protocol::socket&& socket, ndn::nfd::FacePersistency persistency, ndn::nfd::FaceScope faceScope)
+TcpTransport::TcpTransport(protocol::socket&& socket,
+                           ndn::nfd::FacePersistency persistency,
+                           ndn::nfd::FaceScope faceScope)
   : StreamTransport(std::move(socket))
   , m_remoteEndpoint(m_socket.remote_endpoint())
   , m_nextReconnectWait(s_initialReconnectWait)
@@ -103,8 +106,8 @@
     this->setState(TransportState::DOWN);
 
     // cancel all outstanding operations
-    boost::system::error_code error;
-    m_socket.cancel(error);
+    boost::system::error_code ec;
+    m_socket.cancel(ec);
 
     // do this asynchronously because there could be some callbacks still pending
     getGlobalIoService().post([this] { reconnect(); });
@@ -134,7 +137,8 @@
   this->resetReceiveBuffer();
   this->resetSendQueue();
 
-  m_reconnectEvent = scheduler::schedule(m_nextReconnectWait, [this] { this->handleReconnectTimeout(); });
+  m_reconnectEvent = getScheduler().schedule(m_nextReconnectWait,
+                                             [this] { this->handleReconnectTimeout(); });
   m_socket.async_connect(m_remoteEndpoint, [this] (const auto& e) { this->handleReconnect(e); });
 }
 
diff --git a/daemon/face/tcp-transport.hpp b/daemon/face/tcp-transport.hpp
index adf5085..a6a2048 100644
--- a/daemon/face/tcp-transport.hpp
+++ b/daemon/face/tcp-transport.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_FACE_TCP_TRANSPORT_HPP
 
 #include "stream-transport.hpp"
-#include "core/scheduler.hpp"
 
 namespace nfd {
 namespace face {
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index eb4337f..6497c30 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,7 +26,7 @@
 #include "udp-channel.hpp"
 #include "generic-link-service.hpp"
 #include "unicast-udp-transport.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace face {
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index 6730389..2c8cf20 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -26,7 +26,7 @@
 #include "udp-factory.hpp"
 #include "generic-link-service.hpp"
 #include "multicast-udp-transport.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 #include <boost/range/adaptor/map.hpp>
 #include <boost/range/algorithm/copy.hpp>
diff --git a/daemon/face/unicast-ethernet-transport.cpp b/daemon/face/unicast-ethernet-transport.cpp
index 60059bb..ed61d7a 100644
--- a/daemon/face/unicast-ethernet-transport.cpp
+++ b/daemon/face/unicast-ethernet-transport.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,6 +24,7 @@
  */
 
 #include "unicast-ethernet-transport.hpp"
+#include "daemon/global.hpp"
 
 #include <stdio.h>  // for snprintf()
 
@@ -95,7 +96,7 @@
 void
 UnicastEthernetTransport::scheduleClosureWhenIdle()
 {
-  m_closeIfIdleEvent = scheduler::schedule(m_idleTimeout, [this] {
+  m_closeIfIdleEvent = getScheduler().schedule(m_idleTimeout, [this] {
     if (!hasRecentlyReceived()) {
       NFD_LOG_FACE_INFO("Closing due to inactivity");
       this->close();
diff --git a/daemon/face/unicast-ethernet-transport.hpp b/daemon/face/unicast-ethernet-transport.hpp
index 5a148c9..63d74e9 100644
--- a/daemon/face/unicast-ethernet-transport.hpp
+++ b/daemon/face/unicast-ethernet-transport.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_FACE_UNICAST_ETHERNET_TRANSPORT_HPP
 
 #include "ethernet-transport.hpp"
-#include "core/scheduler.hpp"
 
 namespace nfd {
 namespace face {
diff --git a/daemon/face/unicast-udp-transport.cpp b/daemon/face/unicast-udp-transport.cpp
index 062c924..c872c09 100644
--- a/daemon/face/unicast-udp-transport.cpp
+++ b/daemon/face/unicast-udp-transport.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -25,6 +25,7 @@
 
 #include "unicast-udp-transport.hpp"
 #include "udp-protocol.hpp"
+#include "daemon/global.hpp"
 
 #ifdef __linux__
 #include <cerrno>       // for errno
@@ -109,7 +110,7 @@
 void
 UnicastUdpTransport::scheduleClosureWhenIdle()
 {
-  m_closeIfIdleEvent = scheduler::schedule(m_idleTimeout, [this] {
+  m_closeIfIdleEvent = getScheduler().schedule(m_idleTimeout, [this] {
     if (!hasRecentlyReceived()) {
       NFD_LOG_FACE_INFO("Closing due to inactivity");
       this->close();
diff --git a/daemon/face/unicast-udp-transport.hpp b/daemon/face/unicast-udp-transport.hpp
index 03f1c86..fdadfb9 100644
--- a/daemon/face/unicast-udp-transport.hpp
+++ b/daemon/face/unicast-udp-transport.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_FACE_UNICAST_UDP_TRANSPORT_HPP
 
 #include "datagram-transport.hpp"
-#include "core/scheduler.hpp"
 
 namespace nfd {
 namespace face {
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index 172f797..52a4c99 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -26,7 +26,7 @@
 #include "unix-stream-channel.hpp"
 #include "generic-link-service.hpp"
 #include "unix-stream-transport.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 #include <boost/filesystem.hpp>
 #include <sys/stat.h> // for chmod()
diff --git a/daemon/face/websocket-channel.cpp b/daemon/face/websocket-channel.cpp
index c4c392b..74b4d39 100644
--- a/daemon/face/websocket-channel.cpp
+++ b/daemon/face/websocket-channel.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,7 +26,7 @@
 #include "websocket-channel.hpp"
 #include "generic-link-service.hpp"
 #include "websocket-transport.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace face {
diff --git a/daemon/face/websocket-transport.cpp b/daemon/face/websocket-transport.cpp
index 4262287..b7fdc20 100644
--- a/daemon/face/websocket-transport.cpp
+++ b/daemon/face/websocket-transport.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,6 +24,7 @@
  */
 
 #include "websocket-transport.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace face {
@@ -109,7 +110,7 @@
 void
 WebSocketTransport::schedulePing()
 {
-  m_pingEventId = scheduler::schedule(m_pingInterval, [this] { sendPing(); });
+  m_pingEventId = getScheduler().schedule(m_pingInterval, [this] { sendPing(); });
 }
 
 void
diff --git a/daemon/face/websocket-transport.hpp b/daemon/face/websocket-transport.hpp
index c957802..0bdadb5 100644
--- a/daemon/face/websocket-transport.hpp
+++ b/daemon/face/websocket-transport.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,7 +28,6 @@
 
 #include "transport.hpp"
 #include "websocketpp.hpp"
-#include "core/scheduler.hpp"
 
 namespace nfd {
 namespace face {
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index e7e0904..eec5a63 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -26,6 +26,7 @@
 #include "access-strategy.hpp"
 #include "algorithm.hpp"
 #include "core/logger.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace fw {
@@ -42,8 +43,7 @@
     NDN_THROW(std::invalid_argument("AccessStrategy does not accept parameters"));
   }
   if (parsed.version && *parsed.version != getStrategyName()[-1].toVersion()) {
-    NDN_THROW(std::invalid_argument(
-      "AccessStrategy does not support version " + to_string(*parsed.version)));
+    NDN_THROW(std::invalid_argument("AccessStrategy does not support version " + to_string(*parsed.version)));
   }
   this->setInstanceName(makeInstanceName(name, getStrategyName()));
 }
@@ -153,7 +153,7 @@
 
   // schedule RTO timeout
   PitInfo* pi = pitEntry->insertStrategyInfo<PitInfo>().first;
-  pi->rtoTimer = scheduler::schedule(rto,
+  pi->rtoTimer = getScheduler().schedule(rto,
       bind(&AccessStrategy::afterRtoTimeout, this, weak_ptr<pit::Entry>(pitEntry),
            inFace.getId(), mi.lastNexthop));
 
diff --git a/daemon/fw/asf-measurements.cpp b/daemon/fw/asf-measurements.cpp
index 17771e0..dde6866 100644
--- a/daemon/fw/asf-measurements.cpp
+++ b/daemon/fw/asf-measurements.cpp
@@ -24,6 +24,7 @@
  */
 
 #include "asf-measurements.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace fw {
@@ -73,7 +74,7 @@
 FaceInfo::~FaceInfo()
 {
   cancelTimeoutEvent();
-  scheduler::cancel(m_measurementExpirationId);
+  m_measurementExpirationId.cancel();
 }
 
 void
@@ -92,7 +93,7 @@
 void
 FaceInfo::cancelTimeoutEvent()
 {
-  scheduler::cancel(m_timeoutEventId);
+  m_timeoutEventId.cancel();
   m_isTimeoutScheduled = false;
 }
 
@@ -114,7 +115,7 @@
 FaceInfo::recordRtt(const shared_ptr<pit::Entry>& pitEntry, const Face& inFace)
 {
   // Calculate RTT
-  pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(inFace, 0);
+  auto outRecord = pitEntry->getOutRecord(inFace, 0);
 
   if (outRecord == pitEntry->out_end()) { // no out-record
     NFD_LOG_TRACE(pitEntry->getInterest() << " dataFrom inFace=" << inFace.getId() << " no-out-record");
@@ -122,7 +123,7 @@
   }
 
   time::steady_clock::Duration steadyRtt = time::steady_clock::now() - outRecord->getLastRenewed();
-  RttEstimator::Duration durationRtt = time::duration_cast<RttEstimator::Duration>(steadyRtt);
+  auto durationRtt = time::duration_cast<RttEstimator::Duration>(steadyRtt);
 
   m_rttStats.addRttMeasurement(durationRtt);
 
@@ -148,10 +149,9 @@
 }
 
 FaceInfo*
-NamespaceInfo::getFaceInfo(const fib::Entry& fibEntry, FaceId faceId)
+NamespaceInfo::getFaceInfo(const fib::Entry&, FaceId faceId)
 {
-  FaceInfoTable::iterator it = m_fit.find(faceId);
-
+  auto it = m_fit.find(faceId);
   if (it != m_fit.end()) {
     return &it->second;
   }
@@ -161,10 +161,9 @@
 }
 
 FaceInfo&
-NamespaceInfo::getOrCreateFaceInfo(const fib::Entry& fibEntry, FaceId faceId)
+NamespaceInfo::getOrCreateFaceInfo(const fib::Entry&, FaceId faceId)
 {
-  FaceInfoTable::iterator it = m_fit.find(faceId);
-
+  auto it = m_fit.find(faceId);
   FaceInfo* info = nullptr;
 
   if (it == m_fit.end()) {
@@ -190,10 +189,11 @@
 NamespaceInfo::extendFaceInfoLifetime(FaceInfo& info, FaceId faceId)
 {
   // Cancel previous expiration
-  scheduler::cancel(info.getMeasurementExpirationEventId());
+  info.getMeasurementExpirationEventId().cancel();
 
   // Refresh measurement
-  auto id = scheduler::schedule(AsfMeasurements::MEASUREMENTS_LIFETIME, [=] { expireFaceInfo(faceId); });
+  auto id = getScheduler().schedule(AsfMeasurements::MEASUREMENTS_LIFETIME,
+                                    [=] { expireFaceInfo(faceId); });
   info.setMeasurementExpirationEventId(id);
 }
 
diff --git a/daemon/fw/asf-probing-module.cpp b/daemon/fw/asf-probing-module.cpp
index dd2b537..84055f1 100644
--- a/daemon/fw/asf-probing-module.cpp
+++ b/daemon/fw/asf-probing-module.cpp
@@ -25,6 +25,7 @@
 
 #include "asf-probing-module.hpp"
 #include "algorithm.hpp"
+#include "daemon/global.hpp"
 
 #include <ndn-cxx/util/random.hpp>
 
@@ -50,7 +51,7 @@
   Name prefix = fibEntry.getPrefix();
 
   // Set the probing flag for the namespace to true after passed interval of time
-  scheduler::schedule(interval, [this, prefix] {
+  getScheduler().schedule(interval, [this, prefix] {
     NamespaceInfo* info = m_measurements.getNamespaceInfo(prefix);
 
     if (info == nullptr) {
@@ -65,10 +66,8 @@
 }
 
 Face*
-ProbingModule::getFaceToProbe(const Face& inFace,
-                              const Interest& interest,
-                              const fib::Entry& fibEntry,
-                              const Face& faceUsed)
+ProbingModule::getFaceToProbe(const Face& inFace, const Interest& interest,
+                              const fib::Entry& fibEntry, const Face& faceUsed)
 {
   FaceInfoFacePairSet rankedFaces(
     [] (const auto& pairLhs, const auto& pairRhs) -> bool {
@@ -83,7 +82,7 @@
 
   // Put eligible faces into rankedFaces. If a face does not have an RTT measurement,
   // immediately pick the face for probing
-  for (const fib::NextHop& hop : fibEntry.getNextHops()) {
+  for (const auto& hop : fibEntry.getNextHops()) {
     Face& hopFace = hop.getFace();
 
     // Don't send probe Interest back to the incoming face or use the same face
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index 779daee..46acaf4 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -26,6 +26,7 @@
 #include "asf-strategy.hpp"
 #include "algorithm.hpp"
 #include "core/logger.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace fw {
@@ -226,9 +227,8 @@
     NFD_LOG_TRACE("Scheduling timeout for " << fibEntry.getPrefix() << " to: " << egress
                   << " in " << time::duration_cast<time::milliseconds>(timeout) << " ms");
 
-    scheduler::EventId id = scheduler::schedule(timeout,
-        bind(&AsfStrategy::onTimeout, this, interest.getName(), egress.face.getId()));
-
+    auto id = getScheduler().schedule(timeout, bind(&AsfStrategy::onTimeout, this,
+                                                    interest.getName(), egress.face.getId()));
     faceInfo.setTimeoutEvent(id, interest.getName());
   }
 }
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index 7e1880f..a25e107 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,8 +24,8 @@
  */
 
 #include "face-table.hpp"
-#include "core/global-io.hpp"
 #include "core/logger.hpp"
+#include "daemon/global.hpp"
 #include "face/channel.hpp"
 
 #include <ndn-cxx/util/concepts.hpp>
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 508a890..328ff31 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -29,6 +29,7 @@
 #include "best-route-strategy2.hpp"
 #include "strategy.hpp"
 #include "core/logger.hpp"
+#include "daemon/global.hpp"
 #include "table/cleanup.hpp"
 
 #include <ndn-cxx/lp/tags.hpp>
@@ -44,7 +45,7 @@
 }
 
 Forwarder::Forwarder()
-  : m_unsolicitedDataPolicy(new fw::DefaultUnsolicitedDataPolicy())
+  : m_unsolicitedDataPolicy(make_unique<fw::DefaultUnsolicitedDataPolicy>())
   , m_fib(m_nameTree)
   , m_pit(m_nameTree)
   , m_measurements(m_nameTree)
@@ -241,7 +242,7 @@
                 << (pitEntry->isSatisfied ? " satisfied" : " unsatisfied"));
 
   // Dead Nonce List insert if necessary
-  this->insertDeadNonceList(*pitEntry, 0);
+  this->insertDeadNonceList(*pitEntry, nullptr);
 
   // Increment satisfied/unsatisfied Interests counter
   if (pitEntry->isSatisfied) {
@@ -252,7 +253,7 @@
   }
 
   // PIT delete
-  scheduler::cancel(pitEntry->expiryTimer);
+  pitEntry->expiryTimer.cancel();
   m_pit.erase(pitEntry.get());
 }
 
@@ -507,9 +508,8 @@
   BOOST_ASSERT(pitEntry);
   BOOST_ASSERT(duration >= 0_ms);
 
-  scheduler::cancel(pitEntry->expiryTimer);
-
-  pitEntry->expiryTimer = scheduler::schedule(duration, [=] { onInterestFinalize(pitEntry); });
+  pitEntry->expiryTimer.cancel();
+  pitEntry->expiryTimer = getScheduler().schedule(duration, [=] { onInterestFinalize(pitEntry); });
 }
 
 void
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index ecc4d72..18ca483 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -26,11 +26,9 @@
 #ifndef NFD_DAEMON_FW_FORWARDER_HPP
 #define NFD_DAEMON_FW_FORWARDER_HPP
 
-#include "core/common.hpp"
-#include "core/scheduler.hpp"
-#include "forwarder-counters.hpp"
-#include "face-table.hpp"
 #include "face-endpoint.hpp"
+#include "face-table.hpp"
+#include "forwarder-counters.hpp"
 #include "unsolicited-data-policy.hpp"
 #include "table/fib.hpp"
 #include "table/pit.hpp"
@@ -46,9 +44,9 @@
 class Strategy;
 } // namespace fw
 
-/** \brief main class of NFD
+/** \brief Main class of NFD forwarding engine.
  *
- *  Forwarder owns all faces and tables, and implements forwarding pipelines.
+ *  Forwarder owns all faces and tables, and implements the forwarding pipelines.
  */
 class Forwarder
 {
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index a6c1e99..5063200 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -25,6 +25,7 @@
 
 #include "ncc-strategy.hpp"
 #include "algorithm.hpp"
+#include "daemon/global.hpp"
 
 #include <ndn-cxx/util/random.hpp>
 
@@ -90,8 +91,7 @@
     deferRange = time::microseconds((deferFirst.count() + 1) / 2);
     --nUpstreams;
     this->sendInterest(pitEntry, FaceEndpoint(*bestFace, 0), interest);
-    pitEntryInfo->bestFaceTimeout = scheduler::schedule(
-      meInfo.prediction,
+    pitEntryInfo->bestFaceTimeout = getScheduler().schedule(meInfo.prediction,
       bind(&NccStrategy::timeoutOnBestFace, this, weak_ptr<pit::Entry>(pitEntry)));
   }
   else {
@@ -128,7 +128,7 @@
     // this maxInterval would be used to determine when the next doPropagate would happen.
     pitEntryInfo->maxInterval = deferFirst;
   }
-  pitEntryInfo->propagateTimer = scheduler::schedule(deferFirst,
+  pitEntryInfo->propagateTimer = getScheduler().schedule(deferFirst,
     bind(&NccStrategy::doPropagate, this, ingress.face.getId(), weak_ptr<pit::Entry>(pitEntry)));
 }
 
@@ -178,7 +178,7 @@
   if (isForwarded) {
     std::uniform_int_distribution<time::nanoseconds::rep> dist(0, pitEntryInfo->maxInterval.count() - 1);
     time::nanoseconds deferNext(dist(ndn::random::getRandomNumberEngine()));
-    pitEntryInfo->propagateTimer = scheduler::schedule(deferNext,
+    pitEntryInfo->propagateTimer = getScheduler().schedule(deferNext,
       bind(&NccStrategy::doPropagate, this, inFaceId, weak_ptr<pit::Entry>(pitEntry)));
   }
 }
@@ -233,14 +233,14 @@
 
   PitEntryInfo* pitEntryInfo = pitEntry->getStrategyInfo<PitEntryInfo>();
   if (pitEntryInfo != nullptr) {
-    scheduler::cancel(pitEntryInfo->propagateTimer);
+    pitEntryInfo->propagateTimer.cancel();
 
     // Verify that the best face satisfied the interest before canceling the timeout call
     MeasurementsEntryInfo& meInfo = this->getMeasurementsEntryInfo(pitEntry);
     shared_ptr<Face> bestFace = meInfo.getBestFace();
 
     if (bestFace.get() == &ingress.face)
-      scheduler::cancel(pitEntryInfo->bestFaceTimeout);
+      pitEntryInfo->bestFaceTimeout.cancel();
   }
 }
 
@@ -337,8 +337,8 @@
 
 NccStrategy::PitEntryInfo::~PitEntryInfo()
 {
-  scheduler::cancel(this->bestFaceTimeout);
-  scheduler::cancel(this->propagateTimer);
+  bestFaceTimeout.cancel();
+  propagateTimer.cancel();
 }
 
 } // namespace fw
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index 12e6176..f0eab59 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -27,7 +27,7 @@
 #include "algorithm.hpp"
 
 #include "core/logger.hpp"
-#include "core/global-io.hpp"
+#include "daemon/global.hpp"
 #include "rib/service.hpp"
 
 #include <ndn-cxx/lp/empty-value.hpp>
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index bb50556..cc1b2b8 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -51,7 +51,9 @@
     BOOST_ASSERT(strategyName.at(-1).isVersion());
     Registry& registry = getRegistry();
     BOOST_ASSERT(registry.count(strategyName) == 0);
-    registry[strategyName] = &make_unique<S, Forwarder&, const Name&>;
+    registry[strategyName] = [] (auto&&... args) {
+      return make_unique<S>(std::forward<decltype(args)>(args)...);
+    };
   }
 
   /** \return whether a strategy instance can be created from \p instanceName
@@ -81,9 +83,9 @@
   listRegistered();
 
 public: // constructor, destructor, strategy name
-  /** \brief construct a strategy instance
+  /** \brief Construct a strategy instance.
    *  \param forwarder a reference to the forwarder, used to enable actions and accessors.
-   *  \note Strategy subclass constructor should not retain a reference to the forwarder.
+   *  \note Strategy subclass constructor must not retain a reference to \p forwarder.
    */
   explicit
   Strategy(Forwarder& forwarder);
diff --git a/daemon/global.cpp b/daemon/global.cpp
new file mode 100644
index 0000000..bd1dac2
--- /dev/null
+++ b/daemon/global.cpp
@@ -0,0 +1,100 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2019,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "daemon/global.hpp"
+
+namespace nfd {
+
+static thread_local unique_ptr<boost::asio::io_service> g_ioService;
+static thread_local unique_ptr<Scheduler> g_scheduler;
+static boost::asio::io_service* g_mainIoService = nullptr;
+static boost::asio::io_service* g_ribIoService = nullptr;
+
+boost::asio::io_service&
+getGlobalIoService()
+{
+  if (g_ioService == nullptr) {
+    g_ioService = make_unique<boost::asio::io_service>();
+  }
+  return *g_ioService;
+}
+
+Scheduler&
+getScheduler()
+{
+  if (g_scheduler == nullptr) {
+    g_scheduler = make_unique<Scheduler>(getGlobalIoService());
+  }
+  return *g_scheduler;
+}
+
+#ifdef WITH_TESTS
+void
+resetGlobalIoService()
+{
+  g_scheduler.reset();
+  g_ioService.reset();
+}
+#endif
+
+boost::asio::io_service&
+getMainIoService()
+{
+  BOOST_ASSERT(g_mainIoService != nullptr);
+  return *g_mainIoService;
+}
+
+boost::asio::io_service&
+getRibIoService()
+{
+  BOOST_ASSERT(g_ribIoService != nullptr);
+  return *g_ribIoService;
+}
+
+void
+setMainIoService(boost::asio::io_service* mainIo)
+{
+  g_mainIoService = mainIo;
+}
+
+void
+setRibIoService(boost::asio::io_service* ribIo)
+{
+  g_ribIoService = ribIo;
+}
+
+void
+runOnMainIoService(const std::function<void()>& f)
+{
+  getMainIoService().post(f);
+}
+
+void
+runOnRibIoService(const std::function<void()>& f)
+{
+  getRibIoService().post(f);
+}
+
+} // namespace nfd
diff --git a/daemon/global.hpp b/daemon/global.hpp
new file mode 100644
index 0000000..05bc577
--- /dev/null
+++ b/daemon/global.hpp
@@ -0,0 +1,75 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2019  Regents of the University of California,
+ *                          Arizona Board of Regents,
+ *                          Colorado State University,
+ *                          University Pierre & Marie Curie, Sorbonne University,
+ *                          Washington University in St. Louis,
+ *                          Beijing Institute of Technology
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef NFD_DAEMON_GLOBAL_HPP
+#define NFD_DAEMON_GLOBAL_HPP
+
+#include "core/common.hpp"
+
+namespace nfd {
+
+/** \brief Returns the global io_service instance for the calling thread.
+ */
+boost::asio::io_service&
+getGlobalIoService();
+
+/** \brief Returns the global Scheduler instance for the calling thread.
+ */
+Scheduler&
+getScheduler();
+
+boost::asio::io_service&
+getMainIoService();
+
+boost::asio::io_service&
+getRibIoService();
+
+void
+setMainIoService(boost::asio::io_service* 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);
+
+#ifdef WITH_TESTS
+/** \brief Destroy the global io_service instance.
+ *
+ *  It will be recreated at the next invocation of getGlobalIoService().
+ */
+void
+resetGlobalIoService();
+#endif
+
+} // namespace nfd
+
+#endif // NFD_DAEMON_GLOBAL_HPP
diff --git a/daemon/main.cpp b/daemon/main.cpp
index 37f34b5..83012fc 100644
--- a/daemon/main.cpp
+++ b/daemon/main.cpp
@@ -26,10 +26,10 @@
 #include "nfd.hpp"
 #include "rib/service.hpp"
 
-#include "core/global-io.hpp"
 #include "core/logger.hpp"
 #include "core/privilege-helper.hpp"
 #include "core/version.hpp"
+#include "daemon/global.hpp"
 
 #include <string.h> // for strsignal()
 
diff --git a/daemon/mgmt/rib-manager.cpp b/daemon/mgmt/rib-manager.cpp
index 1532627..8db60ab 100644
--- a/daemon/mgmt/rib-manager.cpp
+++ b/daemon/mgmt/rib-manager.cpp
@@ -47,8 +47,7 @@
 const Name RibManager::LOCALHOP_TOP_PREFIX = "/localhop/nfd";
 
 RibManager::RibManager(rib::Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain,
-                       ndn::nfd::Controller& nfdController, Dispatcher& dispatcher,
-                       ndn::util::Scheduler& scheduler)
+                       ndn::nfd::Controller& nfdController, Dispatcher& dispatcher, Scheduler& scheduler)
   : ManagerBase(MGMT_MODULE_NAME, dispatcher)
   , m_rib(rib)
   , m_keyChain(keyChain)
@@ -137,7 +136,7 @@
                " origin=" << route.origin << " cost=" << route.cost);
 
   if (expires) {
-    auto event = m_scheduler.scheduleEvent(*expires, [=] { m_rib.onRouteExpiration(name, route); });
+    auto event = m_scheduler.schedule(*expires, [=] { m_rib.onRouteExpiration(name, route); });
     route.setExpirationEvent(event);
     NFD_LOG_TRACE("Scheduled unregistration at: " << *route.expires);
   }
@@ -459,7 +458,7 @@
 void
 RibManager::scheduleActiveFaceFetch(const time::seconds& timeToWait)
 {
-  m_activeFaceFetchEvent = m_scheduler.scheduleEvent(timeToWait, [this] { fetchActiveFaces(); });
+  m_activeFaceFetchEvent = m_scheduler.schedule(timeToWait, [this] { fetchActiveFaces(); });
 }
 
 void
@@ -477,7 +476,7 @@
   for (auto faceId : m_registeredFaces) {
     if (activeFaceIds.count(faceId) == 0) {
       NFD_LOG_DEBUG("Removing invalid face ID: " << faceId);
-      m_scheduler.scheduleEvent(0_ns, [this, faceId] { this->onFaceDestroyedEvent(faceId); });
+      m_scheduler.schedule(0_ns, [this, faceId] { this->onFaceDestroyedEvent(faceId); });
     }
   }
 
@@ -492,7 +491,7 @@
 
   if (notification.getKind() == ndn::nfd::FACE_EVENT_DESTROYED) {
     NFD_LOG_DEBUG("Received notification for destroyed faceId: " << notification.getFaceId());
-    m_scheduler.scheduleEvent(0_ns, [this, id = notification.getFaceId()] { onFaceDestroyedEvent(id); });
+    m_scheduler.schedule(0_ns, [this, id = notification.getFaceId()] { onFaceDestroyedEvent(id); });
   }
 }
 
diff --git a/daemon/mgmt/rib-manager.hpp b/daemon/mgmt/rib-manager.hpp
index 745cfa2..788a1d0 100644
--- a/daemon/mgmt/rib-manager.hpp
+++ b/daemon/mgmt/rib-manager.hpp
@@ -51,8 +51,7 @@
 {
 public:
   RibManager(rib::Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain,
-             ndn::nfd::Controller& nfdController, Dispatcher& dispatcher,
-             ndn::util::Scheduler& scheduler);
+             ndn::nfd::Controller& nfdController, Dispatcher& dispatcher, Scheduler& scheduler);
 
   /**
    * @brief Apply localhost_security configuration.
@@ -246,14 +245,14 @@
   ndn::KeyChain& m_keyChain;
   ndn::nfd::Controller& m_nfdController;
   Dispatcher& m_dispatcher;
-  ndn::util::Scheduler& m_scheduler;
+  Scheduler& m_scheduler;
 
   ndn::nfd::FaceMonitor m_faceMonitor;
   ndn::ValidatorConfig m_localhostValidator;
   ndn::ValidatorConfig m_localhopValidator;
   bool m_isLocalhopEnabled;
 
-  ndn::util::scheduler::ScopedEventId m_activeFaceFetchEvent;
+  scheduler::ScopedEventId m_activeFaceFetchEvent;
   using FaceIdSet = std::set<uint64_t>;
   FaceIdSet m_registeredFaces; ///< contains FaceIds with one or more Routes in the RIB
 };
diff --git a/daemon/nfd.cpp b/daemon/nfd.cpp
index f4d136a..078d987 100644
--- a/daemon/nfd.cpp
+++ b/daemon/nfd.cpp
@@ -24,9 +24,8 @@
  */
 
 #include "nfd.hpp"
-
+#include "global.hpp"
 #include "core/config-file.hpp"
-#include "core/global-io.hpp"
 #include "core/log-config-section.hpp"
 #include "core/privilege-helper.hpp"
 #include "face/face-system.hpp"
@@ -89,7 +88,7 @@
   m_netmon->onNetworkStateChanged.connect([this] {
       // delay stages, so if multiple events are triggered in short sequence,
       // only one auto-detection procedure is triggered
-      m_reloadConfigEvent = scheduler::schedule(5_s,
+      m_reloadConfigEvent = getScheduler().schedule(5_s,
         [this] {
           NFD_LOG_INFO("Network change detected, reloading face section of the config file...");
           this->reloadConfigFileFaceSection();
diff --git a/daemon/nfd.hpp b/daemon/nfd.hpp
index 4aadc18..ba8efd4 100644
--- a/daemon/nfd.hpp
+++ b/daemon/nfd.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_NFD_HPP
 
 #include "core/config-file.hpp"
-#include "core/scheduler.hpp"
 
 #include <ndn-cxx/net/network-monitor.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
diff --git a/daemon/rib/readvertise/readvertise.cpp b/daemon/rib/readvertise/readvertise.cpp
index 454ab20..49c3400 100644
--- a/daemon/rib/readvertise/readvertise.cpp
+++ b/daemon/rib/readvertise/readvertise.cpp
@@ -44,7 +44,7 @@
   return std::max(newTime, 0_ms);
 }
 
-Readvertise::Readvertise(Rib& rib, ndn::util::Scheduler& scheduler,
+Readvertise::Readvertise(Rib& rib, Scheduler& scheduler,
                          unique_ptr<ReadvertisePolicy> policy,
                          unique_ptr<ReadvertiseDestination> destination)
   : m_scheduler(scheduler)
@@ -162,14 +162,14 @@
     [=] {
       NFD_LOG_DEBUG("advertise " << rrIt->prefix << " success");
       rrIt->retryDelay = RETRY_DELAY_MIN;
-      rrIt->retryEvt = m_scheduler.scheduleEvent(randomizeTimer(m_policy->getRefreshInterval()),
-                                                 [=] { advertise(rrIt); });
+      rrIt->retryEvt = m_scheduler.schedule(randomizeTimer(m_policy->getRefreshInterval()),
+                                            [=] { advertise(rrIt); });
     },
     [=] (const std::string& msg) {
       NFD_LOG_DEBUG("advertise " << rrIt->prefix << " failure " << msg);
       rrIt->retryDelay = std::min(RETRY_DELAY_MAX, rrIt->retryDelay * 2);
-      rrIt->retryEvt = m_scheduler.scheduleEvent(randomizeTimer(rrIt->retryDelay),
-                                                 [=] { advertise(rrIt); });
+      rrIt->retryEvt = m_scheduler.schedule(randomizeTimer(rrIt->retryDelay),
+                                            [=] { advertise(rrIt); });
     });
 }
 
@@ -192,8 +192,8 @@
     [=] (const std::string& msg) {
       NFD_LOG_DEBUG("withdraw " << rrIt->prefix << " failure " << msg);
       rrIt->retryDelay = std::min(RETRY_DELAY_MAX, rrIt->retryDelay * 2);
-      rrIt->retryEvt = m_scheduler.scheduleEvent(randomizeTimer(rrIt->retryDelay),
-                                                 [=] { withdraw(rrIt); });
+      rrIt->retryEvt = m_scheduler.schedule(randomizeTimer(rrIt->retryDelay),
+                                            [=] { withdraw(rrIt); });
     });
 }
 
diff --git a/daemon/rib/readvertise/readvertise.hpp b/daemon/rib/readvertise/readvertise.hpp
index 80dbbc7..a14d438 100644
--- a/daemon/rib/readvertise/readvertise.hpp
+++ b/daemon/rib/readvertise/readvertise.hpp
@@ -45,8 +45,7 @@
 {
 
 public:
-  Readvertise(Rib& rib,
-              ndn::util::Scheduler& scheduler,
+  Readvertise(Rib& rib, Scheduler& scheduler,
               unique_ptr<ReadvertisePolicy> policy,
               unique_ptr<ReadvertiseDestination> destination);
 
@@ -77,7 +76,7 @@
   static const time::milliseconds RETRY_DELAY_MIN;
   static const time::milliseconds RETRY_DELAY_MAX;
 
-  ndn::util::Scheduler& m_scheduler;
+  Scheduler& m_scheduler;
   unique_ptr<ReadvertisePolicy> m_policy;
   unique_ptr<ReadvertiseDestination> m_destination;
 
diff --git a/daemon/rib/readvertise/readvertised-route.hpp b/daemon/rib/readvertise/readvertised-route.hpp
index 7dc02ae..3749336 100644
--- a/daemon/rib/readvertise/readvertised-route.hpp
+++ b/daemon/rib/readvertise/readvertised-route.hpp
@@ -52,7 +52,7 @@
   mutable ndn::security::SigningInfo signer; ///< signer for commands
   mutable size_t nRibRoutes; ///< number of RIB routes that cause the readvertisement
   mutable time::milliseconds retryDelay; ///< retry interval (not used for refresh)
-  mutable ndn::util::scheduler::ScopedEventId retryEvt; ///< retry or refresh event
+  mutable scheduler::ScopedEventId retryEvt; ///< retry or refresh event
 };
 
 inline bool
diff --git a/daemon/rib/route.hpp b/daemon/rib/route.hpp
index f38fbab..92df470 100644
--- a/daemon/rib/route.hpp
+++ b/daemon/rib/route.hpp
@@ -53,14 +53,14 @@
    */
   Route(const ndn::PrefixAnnouncement& ann, uint64_t faceId);
 
-  const ndn::util::scheduler::EventId&
+  const scheduler::EventId&
   getExpirationEvent() const
   {
     return m_expirationEvent;
   }
 
   void
-  setExpirationEvent(const ndn::util::scheduler::EventId& eid)
+  setExpirationEvent(const scheduler::EventId& eid)
   {
     m_expirationEvent = eid;
   }
@@ -101,7 +101,7 @@
   time::steady_clock::TimePoint annExpires;
 
 private:
-  ndn::util::scheduler::EventId m_expirationEvent;
+  scheduler::EventId m_expirationEvent;
 };
 
 bool
diff --git a/daemon/rib/service.cpp b/daemon/rib/service.cpp
index 35c092d..8405c8e 100644
--- a/daemon/rib/service.cpp
+++ b/daemon/rib/service.cpp
@@ -31,8 +31,8 @@
 #include "readvertise/nfd-rib-readvertise-destination.hpp"
 #include "readvertise/readvertise.hpp"
 
-#include "core/global-io.hpp"
 #include "core/logger.hpp"
+#include "daemon/global.hpp"
 
 #include <boost/property_tree/info_parser.hpp>
 #include <ndn-cxx/transport/tcp-transport.hpp>
diff --git a/daemon/rib/service.hpp b/daemon/rib/service.hpp
index fe9b110..1c07d7e 100644
--- a/daemon/rib/service.hpp
+++ b/daemon/rib/service.hpp
@@ -111,7 +111,7 @@
 
   ndn::KeyChain& m_keyChain;
   ndn::Face m_face;
-  ndn::util::Scheduler m_scheduler;
+  Scheduler m_scheduler;
   ndn::nfd::Controller m_nfdController;
 
   Rib m_rib;
diff --git a/daemon/table/cs-policy-priority-fifo.cpp b/daemon/table/cs-policy-priority-fifo.cpp
index 7984739..f350c72 100644
--- a/daemon/table/cs-policy-priority-fifo.cpp
+++ b/daemon/table/cs-policy-priority-fifo.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -25,6 +25,7 @@
 
 #include "cs-policy-priority-fifo.hpp"
 #include "cs.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace cs {
@@ -117,8 +118,8 @@
   }
   else {
     entryInfo->queueType = QUEUE_FIFO;
-    entryInfo->moveStaleEventId = scheduler::schedule(i->getData().getFreshnessPeriod(),
-                                                      [=] { moveToStaleQueue(i); });
+    entryInfo->moveStaleEventId = getScheduler().schedule(i->getData().getFreshnessPeriod(),
+                                                          [=] { moveToStaleQueue(i); });
   }
 
   Queue& queue = m_queues[entryInfo->queueType];
@@ -133,7 +134,7 @@
 
   EntryInfo* entryInfo = m_entryInfoMap[i];
   if (entryInfo->queueType == QUEUE_FIFO) {
-    scheduler::cancel(entryInfo->moveStaleEventId);
+    entryInfo->moveStaleEventId.cancel();
   }
 
   m_queues[entryInfo->queueType].erase(entryInfo->queueIt);
diff --git a/daemon/table/cs-policy-priority-fifo.hpp b/daemon/table/cs-policy-priority-fifo.hpp
index a914891..39b456f 100644
--- a/daemon/table/cs-policy-priority-fifo.hpp
+++ b/daemon/table/cs-policy-priority-fifo.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_TABLE_CS_POLICY_PRIORITY_FIFO_HPP
 
 #include "cs-policy.hpp"
-#include "core/scheduler.hpp"
 
 #include <list>
 
@@ -80,8 +79,7 @@
 public:
   PriorityFifoPolicy();
 
-  virtual
-  ~PriorityFifoPolicy();
+  ~PriorityFifoPolicy() override;
 
 public:
   static const std::string POLICY_NAME;
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
index 85ef388..a958374 100644
--- a/daemon/table/cs.cpp
+++ b/daemon/table/cs.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -44,10 +44,8 @@
 }
 
 Cs::Cs(size_t nMaxPackets)
-  : m_shouldAdmit(true)
-  , m_shouldServe(true)
 {
-  this->setPolicyImpl(makeDefaultPolicy());
+  setPolicyImpl(makeDefaultPolicy());
   m_policy->setLimit(nMaxPackets);
 }
 
diff --git a/daemon/table/cs.hpp b/daemon/table/cs.hpp
index fc161c5..16e28a5 100644
--- a/daemon/table/cs.hpp
+++ b/daemon/table/cs.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -29,7 +29,7 @@
 #include "cs-policy.hpp"
 #include "cs-internal.hpp"
 #include "cs-entry-impl.hpp"
-#include <ndn-cxx/util/signal.hpp>
+
 #include <boost/iterator/transform_iterator.hpp>
 
 namespace nfd {
@@ -210,8 +210,8 @@
   unique_ptr<Policy> m_policy;
   signal::ScopedConnection m_beforeEvictConnection;
 
-  bool m_shouldAdmit; ///< if false, no Data will be admitted
-  bool m_shouldServe; ///< if false, all lookups will miss
+  bool m_shouldAdmit = true; ///< if false, no Data will be admitted
+  bool m_shouldServe = true; ///< if false, all lookups will miss
 };
 
 } // namespace cs
diff --git a/daemon/table/dead-nonce-list.cpp b/daemon/table/dead-nonce-list.cpp
index 720a415..7d6a908 100644
--- a/daemon/table/dead-nonce-list.cpp
+++ b/daemon/table/dead-nonce-list.cpp
@@ -26,6 +26,7 @@
 #include "dead-nonce-list.hpp"
 #include "core/city-hash.hpp"
 #include "core/logger.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 
@@ -58,14 +59,14 @@
     m_queue.push_back(MARK);
   }
 
-  m_markEvent = scheduler::schedule(m_markInterval, [this] { mark(); });
-  m_adjustCapacityEvent = scheduler::schedule(m_adjustCapacityInterval, [this] { adjustCapacity(); });
+  m_markEvent = getScheduler().schedule(m_markInterval, [this] { mark(); });
+  m_adjustCapacityEvent = getScheduler().schedule(m_adjustCapacityInterval, [this] { adjustCapacity(); });
 }
 
 DeadNonceList::~DeadNonceList()
 {
-  scheduler::cancel(m_markEvent);
-  scheduler::cancel(m_adjustCapacityEvent);
+  m_markEvent.cancel();
+  m_adjustCapacityEvent.cancel();
 
   BOOST_ASSERT_MSG(DEFAULT_LIFETIME >= MIN_LIFETIME, "DEFAULT_LIFETIME is too small");
   static_assert(INITIAL_CAPACITY >= MIN_CAPACITY, "INITIAL_CAPACITY is too small");
@@ -124,7 +125,7 @@
 
   NFD_LOG_TRACE("mark nMarks=" << nMarks);
 
-  m_markEvent = scheduler::schedule(m_markInterval, [this] { mark(); });
+  m_markEvent = getScheduler().schedule(m_markInterval, [this] { mark(); });
 }
 
 void
@@ -145,7 +146,7 @@
   m_actualMarkCounts.clear();
   this->evictEntries();
 
-  m_adjustCapacityEvent = scheduler::schedule(m_adjustCapacityInterval, [this] { adjustCapacity(); });
+  m_adjustCapacityEvent = getScheduler().schedule(m_adjustCapacityInterval, [this] { adjustCapacity(); });
 }
 
 void
diff --git a/daemon/table/dead-nonce-list.hpp b/daemon/table/dead-nonce-list.hpp
index ccbf5a1..dea1d51 100644
--- a/daemon/table/dead-nonce-list.hpp
+++ b/daemon/table/dead-nonce-list.hpp
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_TABLE_DEAD_NONCE_LIST_HPP
 
 #include "core/common.hpp"
-#include "core/scheduler.hpp"
 
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/hashed_index.hpp>
diff --git a/daemon/table/measurements-entry.hpp b/daemon/table/measurements-entry.hpp
index 039fe54..fa80327 100644
--- a/daemon/table/measurements-entry.hpp
+++ b/daemon/table/measurements-entry.hpp
@@ -27,7 +27,6 @@
 #define NFD_DAEMON_TABLE_MEASUREMENTS_ENTRY_HPP
 
 #include "strategy-info-host.hpp"
-#include "core/scheduler.hpp"
 
 namespace nfd {
 
diff --git a/daemon/table/measurements.cpp b/daemon/table/measurements.cpp
index 8ab89cc..adfd782 100644
--- a/daemon/table/measurements.cpp
+++ b/daemon/table/measurements.cpp
@@ -27,6 +27,7 @@
 #include "name-tree.hpp"
 #include "pit-entry.hpp"
 #include "fib-entry.hpp"
+#include "daemon/global.hpp"
 
 namespace nfd {
 namespace measurements {
@@ -49,7 +50,7 @@
   entry = nte.getMeasurementsEntry();
 
   entry->m_expiry = time::steady_clock::now() + getInitialLifetime();
-  entry->m_cleanup = scheduler::schedule(getInitialLifetime(), [=] { cleanup(*entry); });
+  entry->m_cleanup = getScheduler().schedule(getInitialLifetime(), [=] { cleanup(*entry); });
 
   return *entry;
 }
@@ -133,9 +134,9 @@
     return;
   }
 
-  scheduler::cancel(entry.m_cleanup);
+  entry.m_cleanup.cancel();
   entry.m_expiry = expiry;
-  entry.m_cleanup = scheduler::schedule(lifetime, [&] { cleanup(entry); });
+  entry.m_cleanup = getScheduler().schedule(lifetime, [&] { cleanup(entry); });
 }
 
 void
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index 42334f0..8100b8e 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -28,7 +28,6 @@
 
 #include "pit-in-record.hpp"
 #include "pit-out-record.hpp"
-#include "core/scheduler.hpp"
 
 #include <list>