34 #include <dbus/dbus.h>
62 int flags = POLLHUP | POLLERR;
85 int ret = pipe(
_pipe);
86 if (ret == -1)
throw Error(
"PipeError:errno",
toString(errno).c_str());
94 debug_log(
"entering dispatcher %p",
this);
102 for (std::list <Pipe *>::iterator p_it =
pipe_list.begin();
106 Pipe *read_pipe = *p_it;
108 unsigned int nbytes = 0;
110 while (read_pipe->
read(buffer, nbytes) > 0)
118 debug_log(
"leaving dispatcher %p",
this);
125 int ret = write(
_fdunlock[1],
"exit", strlen(
"exit"));
126 if (ret == -1)
throw Error(
"WriteError:errno",
toString(errno).c_str());
134 Pipe *new_pipe =
new Pipe(handler, data);
159 debug_log(
"added timeout %p (%s) (%d millies)",
161 ((
Timeout *)bt)->enabled() ?
"on" :
"off",
182 debug_log(
"added watch %p (%s) fd=%d flags=%d",
183 bw, ((
Watch *)bw)->enabled() ?
"on" :
"off", ((
Watch *)bw)->descriptor(), ((
Watch *)bw)->flags());
208 debug_log(
"watch %p ready, flags=%d state=%d",
209 watch, ((
Watch *)watch)->flags(), watch->
state()
214 if (watch->
state() & POLLIN)
215 flags |= DBUS_WATCH_READABLE;
216 if (watch->
state() & POLLOUT)
217 flags |= DBUS_WATCH_WRITABLE;
218 if (watch->
state() & POLLHUP)
219 flags |= DBUS_WATCH_HANGUP;
220 if (watch->
state() & POLLERR)
221 flags |= DBUS_WATCH_ERROR;