Rev 1598 | Rev 1625 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1598 | Rev 1599 | ||
|---|---|---|---|
| 1 | /* |
1 | /* |
| 2 | * |
2 | * |
| 3 | * Copyright (C) 2010 Mattias Runge |
3 | * Copyright (C) 2010 Mattias Runge |
| 4 | * |
4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
8 | * (at your option) any later version. |
| 9 | * |
9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
13 | * GNU General Public License for more details. |
| 14 | * |
14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
18 | * |
| 19 | */ |
19 | */ |
| 20 | 20 | ||
| 21 | #include "IoService.h" |
21 | #include "IoService.h" |
| 22 | 22 | ||
| 23 | namespace atom { |
23 | namespace atom { |
| 24 | namespace common { |
24 | namespace common { |
| 25 | 25 | ||
| 26 | IoService::IoService() : io_service_work_(io_service_) |
26 | IoService::IoService() : io_service_work_(io_service_) |
| 27 | { |
27 | { |
| 28 | boost::thread thread(boost::bind(&boost::asio::io_service::run, &this->io_service_)); |
28 | boost::thread thread(boost::bind(&boost::asio::io_service::run, &this->io_service_)); |
| 29 | this->thread_ = thread.move(); |
29 | this->thread_ = thread.move(); |
| 30 | 30 | ||
| 31 | this->tracker_ = TrackerPointer(new char); |
31 | this->tracker_ = TrackerPointer(new char); |
| 32 | } |
32 | } |
| 33 | 33 | ||
| 34 | IoService::~IoService() |
34 | IoService::~IoService() |
| 35 | { |
35 | { |
| 36 | this->tracker_.reset(); |
36 | this->tracker_.reset(); |
| - | 37 | ||
| - | 38 | this->io_service_.stop(); |
|
| 37 | 39 | ||
| 38 | this->thread_.interrupt(); |
40 | this->thread_.interrupt(); |
| 39 | this->thread_.join(); |
41 | this->thread_.join(); |
| 40 | } |
42 | } |
| 41 | 43 | ||
| 42 | }; // namespace common |
44 | }; // namespace common |
| 43 | }; // namespace atom |
45 | }; // namespace atom |
| 44 | 46 | ||