blob: 74f1dc5943126f55200db34b246055b21ef0610c [file] [log] [blame]
Junxiao Shic041ca32014-02-25 20:01:15 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#include "global-io.hpp"
8
9namespace nfd {
10
11namespace scheduler {
12// defined in scheduler.cpp
13void
14resetGlobalScheduler();
15} // namespace scheduler
16
17static shared_ptr<boost::asio::io_service> g_ioService;
18
19boost::asio::io_service&
20getGlobalIoService()
21{
22 if (!static_cast<bool>(g_ioService)) {
23 g_ioService = make_shared<boost::asio::io_service>();
24 }
25 return *g_ioService;
26}
27
28void
29resetGlobalIoService()
30{
31 scheduler::resetGlobalScheduler();
32 g_ioService.reset();
33}
34
35} // namespace nfd