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 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 debug_log("leaving dispatcher %p", this); | 85 debug_log("leaving dispatcher %p", this); |
86 } | 86 } |
87 | 87 |
88 void BusDispatcher::leave() | 88 void BusDispatcher::leave() |
89 { | 89 { |
90 _running = false; | 90 _running = false; |
91 | 91 |
92 int ret = write(_fdunlock[1],"exit",strlen("exit")); | 92 int ret = write(_fdunlock[1],"exit",strlen("exit")); |
93 » if (ret == -1) throw Error("WriteError:errno", toString(errno).c_str()); | 93 » if (ret == -1) { |
94 | 94 char buffer[128]; // buffer copied in Error constructor |
| 95 throw Error("PipeError:errno", strerror_r(errno, |
| 96 buffer, |
| 97 sizeof(buffer))); |
| 98 } |
95 close(_fdunlock[1]); | 99 close(_fdunlock[1]); |
96 close(_fdunlock[0]); | 100 close(_fdunlock[0]); |
97 } | 101 } |
98 | 102 |
99 void BusDispatcher::do_iteration() | 103 void BusDispatcher::do_iteration() |
100 { | 104 { |
101 dispatch_pending(); | 105 dispatch_pending(); |
102 dispatch(); | 106 dispatch(); |
103 } | 107 } |
104 | 108 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 flags |= DBUS_WATCH_READABLE; | 169 flags |= DBUS_WATCH_READABLE; |
166 if (watch->state() & POLLOUT) | 170 if (watch->state() & POLLOUT) |
167 flags |= DBUS_WATCH_WRITABLE; | 171 flags |= DBUS_WATCH_WRITABLE; |
168 if (watch->state() & POLLHUP) | 172 if (watch->state() & POLLHUP) |
169 flags |= DBUS_WATCH_HANGUP; | 173 flags |= DBUS_WATCH_HANGUP; |
170 if (watch->state() & POLLERR) | 174 if (watch->state() & POLLERR) |
171 flags |= DBUS_WATCH_ERROR; | 175 flags |= DBUS_WATCH_ERROR; |
172 | 176 |
173 watch->handle(flags); | 177 watch->handle(flags); |
174 } | 178 } |
175 | |
OLD | NEW |