34 #include <dbus/dbus.h>
61 int flags = POLLHUP | POLLERR;
84 int ret = pipe(
_pipe);
85 if (ret == -1)
throw Error(
"PipeError:errno",
toString(errno).c_str());
93 debug_log(
"entering dispatcher %p",
this);
101 for (std::list <Pipe *>::iterator p_it =
pipe_list.begin();
105 Pipe *read_pipe = *p_it;
107 unsigned int nbytes = 0;
109 while (read_pipe->
read(buffer, nbytes) > 0)
117 debug_log(
"leaving dispatcher %p",
this);
124 int ret = write(
_fdunlock[1],
"exit", strlen(
"exit"));
125 if (ret == -1)
throw Error(
"WriteError:errno",
toString(errno).c_str());
133 Pipe *new_pipe =
new Pipe(handler, data);
158 debug_log(
"added timeout %p (%s) (%d millies)",
160 ((
Timeout *)bt)->enabled() ?
"on" :
"off",
181 debug_log(
"added watch %p (%s) fd=%d flags=%d",
182 bw, ((
Watch *)bw)->enabled() ?
"on" :
"off", ((
Watch *)bw)->descriptor(), ((
Watch *)bw)->flags());
207 debug_log(
"watch %p ready, flags=%d state=%d",
208 watch, ((
Watch *)watch)->flags(), watch->
state()
213 if (watch->
state() & POLLIN)
214 flags |= DBUS_WATCH_READABLE;
215 if (watch->
state() & POLLOUT)
216 flags |= DBUS_WATCH_WRITABLE;
217 if (watch->
state() & POLLHUP)
218 flags |= DBUS_WATCH_HANGUP;
219 if (watch->
state() & POLLERR)
220 flags |= DBUS_WATCH_ERROR;