all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* AW: AW: AW: Can't interrupt directory_files_internalrunfromtimer-event-handler
@ 2005-08-12  8:16 klaus.berndl
  2005-08-12 19:58 ` Richard M. Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: klaus.berndl @ 2005-08-12  8:16 UTC (permalink / raw)
  Cc: kzeitler, monnier, emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1346 bytes --]

>>    >The best way to do this and make sure it is stealthy is by running a
>>    >subprocess.  The subprocess can run in parallel with Emacs.

>>    Hmm, i'm not sure if this is the best way?!

>If the primitives you need to do the job in Emacs LIsp can be slow, I
>see no other way to do the job except to avoid using those primitives.

I see another way:

IMHO reinventing the wheel for all these (potentially slow) elisp-
primitives is not worth the effort because IMHO for an ECB-user it is
much more important not being blocked. This can be achieved much easier
by implementing the stealthy task so they each key- or mouse-press
immediatelly interrupts a long-lasting action. So i do not really
elisp-threads if there is at least a elisp-tool which guarantees this
interrupt. AFAIK while-no-input is this tool . The only disadvantage
i can see is that it will be first available in Emacs 22. Therefore
my other question in another answer for with-local-quit mentioned by
Stefan (he said, this could be easily backported). AFAICS with-local-quit
would at least guarantee that C-g interrupts a long-lasting iteration
of a stealth task, right?

>Some day maybe that Emacs will have multi-threading, but that
>won't be soon.

I will not stop breathing until this feature will arise ;-)

Thansk for your help
Klaus

[-- Attachment #1.2: Type: text/html, Size: 1973 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: AW: AW: AW: Can't interrupt directory_files_internalrunfromtimer-event-handler
  2005-08-12  8:16 AW: AW: AW: Can't interrupt directory_files_internalrunfromtimer-event-handler klaus.berndl
@ 2005-08-12 19:58 ` Richard M. Stallman
  2005-08-14  6:47   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Richard M. Stallman @ 2005-08-12 19:58 UTC (permalink / raw)
  Cc: kzeitler, monnier, emacs-devel

I looked at the code for directory-files, and it seems you cannot quit
out of it while it is waiting in a system call.  This means that
while-no-input won't currently work when directory-files hangs in that
way.

It is probably possible to implement quitting out of the system call
in directory-files.  Doing this requires setting immediate_quit to 1,
at least while that system call is running.

Which system call takes the long time?  Is it opendir, or readdir?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: AW: AW: AW: Can't interrupt directory_files_internalrunfromtimer-event-handler
  2005-08-12 19:58 ` Richard M. Stallman
@ 2005-08-14  6:47   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2005-08-14  6:47 UTC (permalink / raw)
  Cc: kzeitler, emacs-devel, klaus.berndl

> I looked at the code for directory-files, and it seems you cannot quit
> out of it while it is waiting in a system call.

Why is that?

> It is probably possible to implement quitting out of the system call
> in directory-files.  Doing this requires setting immediate_quit to 1,
> at least while that system call is running.

Looking at this code made me notice that the filename completion doesn't
handle the EAGAIN case like directory-files does.  And also that
directory-files doesn't check QUIT if it had been interrupted, which can
fail to react to C-g in cases such as SYNC_INPUT.
So I've installed the patch below.

> Which system call takes the long time?  Is it opendir, or readdir?

If the NFS server is down, I suspect that either call can stall.


        Stefan


--- dired.c	11 aoû 2005 05:27:35 -0400	1.117
+++ dired.c	14 aoû 2005 02:44:01 -0400	
@@ -224,7 +224,7 @@
 
 #ifdef EAGAIN
       if (dp == NULL && errno == EAGAIN)
-	continue;
+	{ QUIT; continue; }
 #endif
 
       if (dp == NULL)
@@ -533,6 +533,10 @@
 	  dp = (*readfunc) (d);
 #else
 	  dp = readdir (d);
+#endif
+#ifdef EAGAIN
+	  if (dp == NULL && errno == EAGAIN)
+	    { QUIT; continue; }
 #endif
 	  if (!dp) break;
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-14  6:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-12  8:16 AW: AW: AW: Can't interrupt directory_files_internalrunfromtimer-event-handler klaus.berndl
2005-08-12 19:58 ` Richard M. Stallman
2005-08-14  6:47   ` Stefan Monnier

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.