Filter called more than once...

Krishna R sith.list at gmail.com
Tue Mar 6 18:06:39 PST 2007


Hi all,

I have a thread that listens for dbus signals like this by selecting on the
socket. I have a filter function set also.

 while(1)
    {
        retVal = select(socketfd+1, &readSet, NULL, NULL, NULL); // this
thread blocks here

        dbus_connection_read_write_dispatch (conn, 0);

        dstatus = dbus_connection_get_dispatch_status (conn);
        while (dstatus == DBUS_DISPATCH_DATA_REMAINS)
        {
              dbus_connection_read_write_dispatch (conn, 0);
              dstatus = dbus_connection_get_dispatch_status (conn);
        }
   }

Seems to work ok most of the time, but i saw that in one case filter func
was called twice with a signal that was sent once. I do have a check  for
this particular signal in the filterfunc.

The problem seems to be with me returning
DBUS_HANDLER_RESULT_NOT_YET_HANDLED in the filter func! Atleast the problem
went away when i changed it to HANDLED.

Questions:

How is NOT_YET_HANDLED supposed to work?

1.  It should not call the same recv function again if  it already  returned
NOT_YET _HANDLED. Correct?

2.  If a signal is sent out and 2 process are listening for it, if one
process handles the signal and return HANDLED will the other process still
get the signal?

3. Or is the problem how i call the read_write_dispatch() in the above loop?

Unrelated to the above problem,
I read in one of the email threads here that if this kind of stuff is done,
you need to do dbus_threads_init_default(). Is there a corresponding
deinit() when the thread is killed?

Thank you,
K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20070306/7f4cd730/attachment.html


More information about the dbus mailing list