unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test: test-lib.el: replace sleep-for with sit-for in notmuch-test-wait
@ 2012-08-03 12:16 Tomi Ollila
  2012-08-03 20:52 ` Austin Clements
  2012-08-04 23:17 ` [PATCH v2] " Tomi Ollila
  0 siblings, 2 replies; 4+ messages in thread
From: Tomi Ollila @ 2012-08-03 12:16 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila

The function `notmuch-test-wait` called `get-buffer-process` and
`sleep-for` in a loop. On some emacses neither of these cause emacs
to check whether the process has exited and update it's status
accordingly. In this case the loop does not exit.

The function `sit-for` goes into event loop via `read-event` function
call. `read-event` does not return when process exits but the event
loop used to determine whether there is keyboard, mouse, etc. event
updates the process status as a side effect of the (more generic)
event loop. `sit-for` is used here to restore the event into queue
in the improbable case `read-event` consumes an event.
---
 test/test-lib.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 5dd6271..d14246a 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -38,7 +38,8 @@
 (defun notmuch-test-wait ()
   "Wait for process completion."
   (while (get-buffer-process (current-buffer))
-    (sleep-for 0.1)))
+    ;; sit-for visits event loop for process exit notification.
+    (sit-for 0.1)))
 
 (defun test-output (&optional filename)
   "Save current buffer to file FILENAME.  Default FILENAME is OUTPUT."
-- 
1.7.1

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

end of thread, other threads:[~2012-08-04 23:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-03 12:16 [PATCH] test: test-lib.el: replace sleep-for with sit-for in notmuch-test-wait Tomi Ollila
2012-08-03 20:52 ` Austin Clements
2012-08-04  7:05   ` Tomi Ollila
2012-08-04 23:17 ` [PATCH v2] " Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).