emacs-devel
[Top][All Lists]
Advanced

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

Re: Reading D-Bus messages


From: Jan Djärv
Subject: Re: Reading D-Bus messages
Date: Sat, 25 Sep 2010 09:19:11 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4



Michael Albinus skrev 2010-09-24 23.11:
Eli Zaretskii<address@hidden>  writes:

From: Michael Albinus<address@hidden>
Cc: Eli Zaretskii<address@hidden>, Ken Brown<address@hidden>,
         "address@hidden"<address@hidden>
Date: Fri, 24 Sep 2010 17:10:14 +0200

Handling D-Bus messages like process output would not be reasonable,
because one needs to requests this via accept-process-output. And there
is no related process.

I didn't say like process output, I said inside
wait_reading_process_output.  That function does more than just read
process output, please take a look.

Looks promising. Over the weekend, I'll try to write an own xd_select, and
to call it there. I will take xg_select as example to steal code from :-)


No, please don't, you have total control over your filed escriptors xg_select was done because file descriptors are handeled outside of Emacs control.

We should have a general way to add file descriptors and get a callback for them. In the mean time, do something like this in process.c:

static SELECT_TYPE dbus_mask;

void
add_dbus_fd (int fd)
{
  FD_SET (fd, &dbus_mask);
  add_keyboard_wait_descriptor (fd);
}

void
remove_dbus_fd (int fd)
{
  FD_CLR (fd, &dbus_mask);
  remove_keyboard_wait_descriptor (fd);
}

After this wait_reading_process_output

      /* Check for data from a process.  */
      if (no_avail || nfds == 0)
        continue;

add
      for (channel = 0; channel <= max_keyboard_desc; ++channel)
         if (FD_ISSET (channel, &dbus_mask) && FD_ISSET (channel, &Available))
            {
                 xd_read_queued_messages ();
                 break; /* All dbus channels has been read, exit loop */
            }

and in init_process:

      FD_ZERO (&dbus_mask);


Use remove_dbus_fd and add_dbus_fd in dbusbind.c.
But maybe I'll add that general input mechanism instead, well see.

        Jan D.



reply via email to

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