emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading D-Bus messages


From: Daniel Pittman
Subject: Re: Reading D-Bus messages
Date: Mon, 17 Aug 2009 14:05:51 +1000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

YAMAMOTO Mitsuharu <address@hidden> writes:
>>>>>> On Sun, 16 Aug 2009 14:30:54 +0200, Michael Albinus <address@hidden> 
>>>>>> said:
>
>> Finally, it was sufficient to add the D-Bus file descriptors via
>> add_keyboard_wait_descriptor. Thanks for pushing me into the right
>> direction!
>
> But again, the documentation of
> dbus_connection_get_socket/dbus_connection_get_unix_fd says "DO NOT read or
> write to the file descriptor, or try to select() on it; use DBusWatch for
> main loop integration."  What you want to do is actually a kind of "main
> loop integration", though it looks a bit different from those in typical GUI
> toolkits.

http://dbus.freedesktop.org/doc/api/html/group__DBusWatch.html#g436561729dce54092d8874f38f71308b

The mechanism you want is 'dbus_watch_get_socket', akin to:

    DBusWatch *watch = ...;
    /* TODO: Reverse these on Win32, which prefers the opposite. */
    int socket = dbus_watch_get_unix_fd(watch)
    if (socket == -1) {
        socket = dbus_watch_get_socket(watch);
        if (socket == -1) { abort("can't cope, off to mordor"); }
    }

Then, attach the socket returned from the DBusWatch subsystem to select on.
Presumably this allows the DBus system to abstract away the raw socket
connection and the watch connection, so the former can change without
perturbing the later.

Regards,
        Daniel

-- 
✣ Daniel Pittman            ✉ address@hidden            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons
   Looking for work?  Love Perl?  In Melbourne, Australia?  We are hiring.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]