all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Paul Eggert <eggert@cs.ucla.edu>, emacs-devel@gnu.org
Subject: Re: Using glib's g_file_monitor_file and g_file_monitor_directory
Date: Fri, 7 Jun 2013 12:53:51 +0200	[thread overview]
Message-ID: <74C82774-F83F-46E4-9865-C2649FD481D0@swipnet.se> (raw)
In-Reply-To: <87hahba47a.fsf@gmx.de>

Hello.

6 jun 2013 kl. 13:06 skrev Michael Albinus <michael.albinus@gmx.de>:

> Jan Djärv <jan.h.d@swipnet.se> writes:
> 
>> Hello.
> 
> Hi,
> 
>>> I've committed a patch to the trunk which prevents this crash. However,
>>> if you call "emacs -nw", you won't get any notification. I suppose we
>>> need an generalized g_main_loop integration, synchronized with the code
>>> in gtkutil.c.
>>> 
>>> Likely, we must move this code out of gtkutil.c and gfilenotify.c. Jan?
>> 
>> 
>> Which code?  The glib event loop integration is in xgselect.c.  I
>> think it is called in the -nw case also.  It is only dependent on
>> HAVE_GLIB.
>> The Gtk+ event loop integration is in xterm.c, it is a separate thing.
> 
> I was thinking about the g_main_loop_run and g_main_loop_quit calls in
> gtkutil.c. Reading the code in more detail, it looks like the calls have
> a local scope only, so we don't need to sync.

Right, it is only used when popping up a dialog.

> 
> gfilenotify.c needs a running glib event loop. If Emacs is called with
> the "-nw" flag there is no such event loop; it must be started in a new
> thread by gfilenotify.c I believe.


No need for that, you can just apply the patch below to xgselect.c and you will have a glib handling events for -nw.  The first call to g_main_context_pending does not return true for file monitoring events, why I don't know.  I think the window check was added for bug 9754 (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9754), but you have to remove it for -nw.

=== modified file 'src/xgselect.c'
--- src/xgselect.c      2013-06-03 18:47:35 +0000
+++ src/xgselect.c      2013-06-07 10:40:37 +0000
@@ -44,15 +44,12 @@
   int i, nfds, tmo_in_millisec;
   USE_SAFE_ALLOCA;
 
-  if (! (window_system_available (NULL)
-        && g_main_context_pending (context = g_main_context_default ())))
-    return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask);
-
   if (rfds) all_rfds = *rfds;
   else FD_ZERO (&all_rfds);
   if (wfds) all_wfds = *wfds;
   else FD_ZERO (&all_wfds);
 
+  context = g_main_context_default ();
   n_gfds = g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec,
                                 gfds, gfds_size);
   if (gfds_size < n_gfds)


	Jan D.




  reply	other threads:[~2013-06-07 10:53 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 20:40 Using glib's g_file_monitor_file and g_file_monitor_directory Michael Albinus
2013-03-21 14:06 ` Ted Zlatanov
2013-03-21 14:54   ` Michael Albinus
2013-03-21 16:05     ` Ted Zlatanov
2013-03-22  7:52       ` Michael Albinus
2013-04-01 11:36 ` Michael Albinus
2013-04-01 17:50   ` Jan Djärv
2013-04-03 18:12   ` Stefan Monnier
2013-04-03 19:21     ` James Cloos
2013-04-03 19:36       ` Eli Zaretskii
2013-04-03 20:46         ` James Cloos
2013-04-03 19:55       ` Michael Albinus
2013-04-03 19:58         ` James Cloos
2013-04-04  0:49       ` Stefan Monnier
2013-05-28 10:39     ` Michael Albinus
2013-05-28 14:44       ` Paul Eggert
2013-05-28 15:33         ` Eli Zaretskii
2013-05-28 16:02           ` Paul Eggert
2013-05-28 16:21             ` Stefan Monnier
2013-05-28 16:45               ` Eli Zaretskii
2013-05-28 18:19                 ` Stefan Monnier
2013-05-29 13:46               ` Michael Albinus
2013-05-29 14:03                 ` Stefan Monnier
2013-05-29 14:09                   ` Michael Albinus
2013-05-29 17:40                     ` Stefan Monnier
2013-05-30 14:09                       ` Michael Albinus
2013-05-30 21:08                         ` Stefan Monnier
2013-05-28 16:43             ` Eli Zaretskii
2013-05-28 16:52               ` Paul Eggert
2013-05-28 16:59                 ` Eli Zaretskii
2013-05-28 19:32                   ` Paul Eggert
2013-05-28 15:58         ` Michael Albinus
2013-05-28 19:04           ` Paul Eggert
2013-05-28 20:31             ` Michael Albinus
2013-05-28 20:38               ` Paul Eggert
2013-05-29  6:12                 ` Michael Albinus
2013-05-31  1:42                   ` bug#14474: " Paul Eggert
2013-05-31 18:39                     ` Michael Albinus
2013-05-31 19:24                       ` Paul Eggert
2013-05-31 20:59                         ` Michael Albinus
2013-05-31 22:08                         ` Jan Djärv
2013-05-28 15:29       ` Eli Zaretskii
2013-05-29 13:30         ` Michael Albinus
2013-05-29 15:25           ` Eli Zaretskii
2013-05-29 15:57             ` Michael Albinus
2013-05-30 20:15               ` Daniel Colascione
2013-05-31  6:38                 ` Michael Albinus
2013-06-02 16:57               ` Eli Zaretskii
2013-06-03 13:21                 ` Michael Albinus
2013-06-03 15:12                   ` Eli Zaretskii
2013-06-03 15:30                     ` Glenn Morris
2013-06-03 16:29                       ` Eli Zaretskii
2013-06-03 17:04                         ` Eli Zaretskii
2013-06-03 17:27                           ` Glenn Morris
2013-06-03 19:41                             ` Michael Albinus
2013-06-04  6:09                               ` Paul Eggert
2013-06-05 13:25                                 ` Michael Albinus
2013-06-05 18:37                                   ` Jan Djärv
2013-06-06 11:06                                     ` Michael Albinus
2013-06-07 10:53                                       ` Jan Djärv [this message]
2013-06-07 12:18                                         ` Michael Albinus
2013-06-07 14:22                                           ` Jan Djärv
2013-06-07 14:50                                             ` Michael Albinus
2013-06-08  8:50                                               ` Jan Djärv
2013-06-04  6:45                               ` Paul Eggert
2013-06-04 15:16                                 ` Eli Zaretskii
2013-06-04 15:50                                   ` Paul Eggert
2013-06-05  1:23                                     ` Stefan Monnier
2013-06-06  7:10                                       ` Paul Eggert
2013-06-03 19:10                     ` Michael Albinus
2013-05-30 11:11             ` Ken Brown
2013-05-28 15:30       ` Eli Zaretskii
2013-05-29 13:31         ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74C82774-F83F-46E4-9865-C2649FD481D0@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.