From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Magnus Henoch Newsgroups: gmane.emacs.devel Subject: Re: Threads in emacs implementation Date: Wed, 08 Jun 2005 23:43:24 +0200 Message-ID: <87ll5ka5j7.fsf@zemdatav.stor.no-ip.org> References: <6dbd4d0005060619227dd41364@mail.gmail.com> <87vf4oaft8.fsf@zemdatav.stor.no-ip.org> <87vf4oaao5.fsf@kanga.tapsellferrier.co.uk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1118267557 10919 80.91.229.2 (8 Jun 2005 21:52:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 8 Jun 2005 21:52:37 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 08 23:52:36 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dg8SN-0007mn-2t for ged-emacs-devel@m.gmane.org; Wed, 08 Jun 2005 23:51:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dg8ZA-0000Z2-8t for ged-emacs-devel@m.gmane.org; Wed, 08 Jun 2005 17:58:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dg8YJ-0000HM-Ra for emacs-devel@gnu.org; Wed, 08 Jun 2005 17:57:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dg8YH-0000GH-S5 for emacs-devel@gnu.org; Wed, 08 Jun 2005 17:57:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dg8YH-0000Dt-JK for emacs-devel@gnu.org; Wed, 08 Jun 2005 17:57:33 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1Dg8Oo-0005BK-7i for emacs-devel@gnu.org; Wed, 08 Jun 2005 17:47:46 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Dg8JH-0006PK-Vm for emacs-devel@gnu.org; Wed, 08 Jun 2005 23:42:03 +0200 Original-Received: from h170n1fls23o1074.bredband.comhem.se ([213.67.239.170]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jun 2005 23:42:03 +0200 Original-Received: from mange by h170n1fls23o1074.bredband.comhem.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jun 2005 23:42:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 31 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: h170n1fls23o1074.bredband.comhem.se User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (berkeley-unix) Cancel-Lock: sha1:fonIH2PG4QWxwVRP1m/2obwZB5E= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:38379 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:38379 Nic Ferrier 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