| OLD | NEW |
| 1 /* | 1 /* |
| 2 * | 2 * |
| 3 * D-Bus++ - C++ bindings for D-Bus | 3 * D-Bus++ - C++ bindings for D-Bus |
| 4 * | 4 * |
| 5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> | 5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> |
| 6 * | 6 * |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| 11 * version 2.1 of the License, or (at your option) any later version. | 11 * version 2.1 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Lesser General Public License for more details. | 16 * Lesser General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Lesser General Public | 18 * You should have received a copy of the GNU Lesser General Public |
| 19 * License along with this library; if not, write to the Free Software | 19 * License along with this library; if not, write to the Free Software |
| 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 * | 21 * |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 | 24 |
| 25 #ifndef __DBUSXX_EVENTLOOP_INTEGRATION_H | 25 #ifndef __DBUSXX_EVENTLOOP_INTEGRATION_H |
| 26 #define __DBUSXX_EVENTLOOP_INTEGRATION_H | 26 #define __DBUSXX_EVENTLOOP_INTEGRATION_H |
| 27 | 27 |
| 28 #include <errno.h> | 28 #include <errno.h> |
| 29 #include <string.h> |
| 29 #include "api.h" | 30 #include "api.h" |
| 30 #include "dispatcher.h" | 31 #include "dispatcher.h" |
| 31 #include "util.h" | 32 #include "util.h" |
| 32 #include "eventloop.h" | 33 #include "eventloop.h" |
| 33 | 34 |
| 34 namespace DBus { | 35 namespace DBus { |
| 35 | 36 |
| 36 /* | 37 /* |
| 37 * Glue between the event loop and the DBus library | 38 * Glue between the event loop and the DBus library |
| 38 */ | 39 */ |
| (...skipping 22 matching lines...) Expand all Loading... |
| 61 { | 62 { |
| 62 public: | 63 public: |
| 63 | 64 |
| 64 int _pipe[2]; | 65 int _pipe[2]; |
| 65 | 66 |
| 66 BusDispatcher() : _running(false) | 67 BusDispatcher() : _running(false) |
| 67 { | 68 { |
| 68 //pipe to create a new fd used to unlock a dispatcher at any | 69 //pipe to create a new fd used to unlock a dispatcher at any |
| 69 // moment (used by leave function) | 70 // moment (used by leave function) |
| 70 int ret = pipe(_pipe); | 71 int ret = pipe(_pipe); |
| 71 » » if (ret == -1) throw Error("PipeError:errno", toString(errno).c_
str()); | 72 » » if (ret == -1) { |
| 72 | 73 char buffer[128]; // buffer copied in Error constructor |
| 74 throw Error("PipeError:errno", strerror_r(errno, |
| 75 buffer, |
| 76 sizeof(buffer))); |
| 77 } |
| 73 _fdunlock[0] = _pipe[0]; | 78 _fdunlock[0] = _pipe[0]; |
| 74 _fdunlock[1] = _pipe[1]; | 79 _fdunlock[1] = _pipe[1]; |
| 75 | 80 |
| 76 } | 81 } |
| 77 | 82 |
| 78 ~BusDispatcher() | 83 ~BusDispatcher() |
| 79 {} | 84 {} |
| 80 | 85 |
| 81 virtual void enter(); | 86 virtual void enter(); |
| 82 | 87 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 97 void timeout_expired(DefaultTimeout &); | 102 void timeout_expired(DefaultTimeout &); |
| 98 | 103 |
| 99 private: | 104 private: |
| 100 | 105 |
| 101 bool _running; | 106 bool _running; |
| 102 }; | 107 }; |
| 103 | 108 |
| 104 } /* namespace DBus */ | 109 } /* namespace DBus */ |
| 105 | 110 |
| 106 #endif//__DBUSXX_EVENTLOOP_INTEGRATION_H | 111 #endif//__DBUSXX_EVENTLOOP_INTEGRATION_H |
| OLD | NEW |