From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Pittman Newsgroups: gmane.emacs.devel Subject: Re: Reading D-Bus messages Date: Mon, 17 Aug 2009 14:05:51 +1000 Message-ID: <871vnbgk4g.fsf@rimspace.net> References: <8763co99ax.fsf@gmx.de> <87eircq6td.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1250482709 19868 80.91.229.12 (17 Aug 2009 04:18:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Aug 2009 04:18:29 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 17 06:18:22 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mctfp-0003Fi-Lc for ged-emacs-devel@m.gmane.org; Mon, 17 Aug 2009 06:18:21 +0200 Original-Received: from localhost ([127.0.0.1]:38609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mctfo-0001nc-Mk for ged-emacs-devel@m.gmane.org; Mon, 17 Aug 2009 00:18:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mctfj-0001nS-0o for emacs-devel@gnu.org; Mon, 17 Aug 2009 00:18:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mctfe-0001nC-LE for emacs-devel@gnu.org; Mon, 17 Aug 2009 00:18:14 -0400 Original-Received: from [199.232.76.173] (port=34714 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mctfe-0001n9-GZ for emacs-devel@gnu.org; Mon, 17 Aug 2009 00:18:10 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:54941) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mctfe-0003wC-5t for emacs-devel@gnu.org; Mon, 17 Aug 2009 00:18:10 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1MctfZ-00038j-JV for emacs-devel@gnu.org; Mon, 17 Aug 2009 06:18:05 +0200 Original-Received: from sdcarl02.strategicdata.com.au ([203.214.67.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 17 Aug 2009 06:18:05 +0200 Original-Received: from daniel by sdcarl02.strategicdata.com.au with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 17 Aug 2009 06:18:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: sdcarl02.strategicdata.com.au User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:cTGl7gxOnNztqZLL8Ca8jYRQH+M= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114332 Archived-At: YAMAMOTO Mitsuharu writes: >>>>>> On Sun, 16 Aug 2009 14:30:54 +0200, Michael Albinus 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 ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons Looking for work? Love Perl? In Melbourne, Australia? We are hiring.