emacs-devel
[Top][All Lists]
Advanced

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

Re: Threads in emacs implementation


From: Magnus Henoch
Subject: Re: Threads in emacs implementation
Date: Wed, 08 Jun 2005 23:43:24 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (berkeley-unix)

Nic Ferrier <address@hidden> writes:

> We don't need threads in elisp. Just more asynchronous network
> implementations.

Good point.

What is the best way to send a large amount of data to a network
connection in the background?  You could send a chunk at a time with
process-send-string and then recurse with run-with-idle-timer, but it
seems that this will either block the UI or cause unnecessarily slow
transfer unless the chunk size and the delay are right.

> Anyway, async code is so much more fun to write than threaded
> code. Threads are for beginners.

Can you elaborate?  I don't see how

(defun foo-1 ()
  (send-request-with-callback 'foo-2))

(defun foo-2 (response)
  (do-something response))

is more fun to write than:

(defun foo ()
  (let ((response (send-request-and-get-response)))
    (do-something response)))

Magnus





reply via email to

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