From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#18861: Acknowledgement (25.0.50; gfile-based file notifications are not immediate) Date: Tue, 28 Oct 2014 14:30:17 -0700 Message-ID: <87vbn3eup2.fsf@secretsauce.net> References: <87zjchdokj.fsf@secretsauce.net> <87wq7kes7w.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1414532661 26621 80.91.229.3 (28 Oct 2014 21:44:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Oct 2014 21:44:21 +0000 (UTC) To: 18861@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 28 22:44:16 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XjEYp-0005id-NX for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Oct 2014 22:44:15 +0100 Original-Received: from localhost ([::1]:41541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjEYp-0005GU-Bp for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Oct 2014 17:44:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjEYh-0005Ew-Eb for bug-gnu-emacs@gnu.org; Tue, 28 Oct 2014 17:44:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjEYc-0001vv-Mg for bug-gnu-emacs@gnu.org; Tue, 28 Oct 2014 17:44:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjEYc-0001vr-79 for bug-gnu-emacs@gnu.org; Tue, 28 Oct 2014 17:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XjEYb-0008RG-Rd for bug-gnu-emacs@gnu.org; Tue, 28 Oct 2014 17:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Oct 2014 21:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18861 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18861-submit@debbugs.gnu.org id=B18861.141453263932423 (code B ref 18861); Tue, 28 Oct 2014 21:44:01 +0000 Original-Received: (at 18861) by debbugs.gnu.org; 28 Oct 2014 21:43:59 +0000 Original-Received: from localhost ([127.0.0.1]:38053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XjEYY-0008Qs-Cv for submit@debbugs.gnu.org; Tue, 28 Oct 2014 17:43:58 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:38586) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XjEYV-0008Qi-Gl for 18861@debbugs.gnu.org; Tue, 28 Oct 2014 17:43:56 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D30A920A43 for <18861@debbugs.gnu.org>; Tue, 28 Oct 2014 17:43:54 -0400 (EDT) Original-Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 28 Oct 2014 17:43:54 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=x-sasl-enc:references:from:to:subject:date:in-reply-to :message-id:mime-version:content-type; s=mesmtp; bh=WNBshXDZCL9D zcYlIl+szp52CXQ=; b=E7w4zTDKYwRWAymm9vi+w8nNFS0F8Yx2i2Nc4fGFoASP OvQTF8+eVHqFso8Mdctp9OXJI8tJ1oBiTscI7+PIbnH93mGP5nHXEVigKR7iLTom c9PgbznJOdefbqJgnu06ZiMvvmTOwrFqIMfc5Rlc485z6IA00baOUHWqIZ8GvRg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:references:from:to:subject :date:in-reply-to:message-id:mime-version:content-type; s= smtpout; bh=WNBshXDZCL9DzcYlIl+szp52CXQ=; b=cG2nQYTMSrHT1oUmHx8V YW80yCvC+/iPQguzVCARjlhwxSoOwLzwKsEogj06DjZZ3FUNKE1E5ymO4JaJadGF PIqKj0Hhbc69lopG1haq+t9YWo5ReJ0RPslLUf0H89ATHeDmc0cNhLVpdBQNJdl9 Q10pLa8QPBzi0F6WenJ0LGc= X-Sasl-enc: tccjkqkeCuyJjF2NZuTwxCCOYY4CUA2tTav9JdBGqsYW 1414532634 Original-Received: from shorty.local (unknown [208.90.186.108]) by mail.messagingengine.com (Postfix) with ESMTPA id 8D426680125 for <18861@debbugs.gnu.org>; Tue, 28 Oct 2014 17:43:54 -0400 (EDT) Original-Received: from dima by shorty.local with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1XjEYT-0002D3-IE for 18861@debbugs.gnu.org; Tue, 28 Oct 2014 14:43:53 -0700 In-reply-to: <87wq7kes7w.fsf@secretsauce.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:95223 --=-=-= Content-Type: text/plain Control: tags -1 + patch Hi. A glib maintainer responded to the bug report, and it turns out emacs was using glib slightly incorrectly. I'm attaching a patch to fix the issue, as suggested by the maintainer. With this patch, the pselect() call in emacs does see the glib notification as it should. There is still an issue (also in glib) where this notification comes about 1 second after the actual file system activity, so I'm keeping this bug open. The glib bug tracker entry about THIS problem is here: https://bugzilla.gnome.org/show_bug.cgi?id=739322 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-xg_select-now-acquires-the-glib-context-before-query.patch >From eb3579400f098a7cb43f55e48262c2939ff33254 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 28 Oct 2014 14:29:01 -0700 Subject: [PATCH] xg_select() now acquires the glib context before querying it Prior to this patch we were calling g_main_context_query() without calling g_main_context_acquire(). This resulted in the file descriptors returned by g_main_context_query() missing activity. I.e. something would happen in glib, but a select() on the file descriptors would keep blocking. We now acquire the context, which makes select() return on activity, as it should. This is emacs and glib bugs: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18861 https://bugzilla.gnome.org/show_bug.cgi?id=739274 --- src/xgselect.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/xgselect.c b/src/xgselect.c index bf889a9..a830b7d 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -55,11 +55,20 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, GPollFD *gfds = gfds_buf; int gfds_size = ARRAYELTS (gfds_buf); int n_gfds, retval = 0, our_fds = 0, max_fds = fds_lim - 1; + bool context_acquired = false; int i, nfds, tmo_in_millisec; bool need_to_dispatch; USE_SAFE_ALLOCA; context = g_main_context_default (); + if( g_main_context_acquire(context) != TRUE ) + { + // we couldn't acquire the context. I let this function proceed because it + // handles more than just glib file descriptors + retval = -1; + } + else + context_acquired = true; if (rfds) all_rfds = *rfds; else FD_ZERO (&all_rfds); @@ -152,6 +161,9 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, errno = pselect_errno; } + if (context_acquired) + g_main_context_release(context); + /* To not have to recalculate timeout, return like this. */ if ((our_fds > 0 || (nfds == 0 && tmop == &tmo)) && (retval == 0)) { -- 2.0.0 --=-=-=--