Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame^] | 1 | /* -*- 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 | |
| 9 | namespace nfd { |
| 10 | |
| 11 | namespace scheduler { |
| 12 | // defined in scheduler.cpp |
| 13 | void |
| 14 | resetGlobalScheduler(); |
| 15 | } // namespace scheduler |
| 16 | |
| 17 | static shared_ptr<boost::asio::io_service> g_ioService; |
| 18 | |
| 19 | boost::asio::io_service& |
| 20 | getGlobalIoService() |
| 21 | { |
| 22 | if (!static_cast<bool>(g_ioService)) { |
| 23 | g_ioService = make_shared<boost::asio::io_service>(); |
| 24 | } |
| 25 | return *g_ioService; |
| 26 | } |
| 27 | |
| 28 | void |
| 29 | resetGlobalIoService() |
| 30 | { |
| 31 | scheduler::resetGlobalScheduler(); |
| 32 | g_ioService.reset(); |
| 33 | } |
| 34 | |
| 35 | } // namespace nfd |