emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trunk r116456: Improve dbus performance on synchronous calls


From: Daniel Colascione
Subject: Re: trunk r116456: Improve dbus performance on synchronous calls
Date: Mon, 17 Feb 2014 08:17:43 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 02/17/2014 08:06 AM, Michael Albinus wrote:
Daniel Colascione <address@hidden> writes:

      (with-timeout ((if timeout (/ timeout 1000.0) 25))
        (while (eq (gethash key dbus-return-values-table :ignore) :ignore)
-       (let ((event (let ((inhibit-redisplay t) unread-command-events)
-                      (read-event nil nil 0.1))))
-         (when (and event (not (ignore-errors (dbus-check-event event))))
-           (setq unread-command-events
-                 (append unread-command-events (list event)))))))
+        (let ((event (let ((inhibit-redisplay t) unread-command-events)
+                      (read-event nil nil check-interval))))
+          (when event
+            (push event unread-command-events))
+          (when (< check-interval 1)
+            (setf check-interval (* check-interval 1.05))))))

Why `push'? It adds the event on top of `unread-command-events',
changing the event order when there are already events in that list.

Hrm. I was getting it from sit-for:

(let ((read (read-event nil t seconds)))
      (or (null read)
          (progn
            ;; If last command was a prefix arg, e.g. C-u, push this event onto
            ;; unread-command-events as (t . EVENT) so it will be added to
            ;; this-command-keys by read-key-sequence.
            (if (eq overriding-terminal-local-map universal-argument-map)
                (setq read (cons t read)))
            (push read unread-command-events)
            nil)))

Speaking of which, shouldn't the dbus code just look like this?

(with-timeout ((if timeout (/ timeout 1000.0) 25))
      (while (eq (gethash key dbus-return-values-table :ignore) :ignore)
        (sit-for check-interval t)
        (when (< check-interval 1)
          (setf check-interval (* check-interval 1.05)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]