unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nic Ferrier <nferrier@tapsellferrier.co.uk>
Cc: emacs-devel@gnu.org
Subject: Re: Threads in emacs implementation
Date: Wed, 08 Jun 2005 23:26:02 +0100	[thread overview]
Message-ID: <87mzq0a3k5.fsf@kanga.tapsellferrier.co.uk> (raw)
In-Reply-To: <87ll5ka5j7.fsf@zemdatav.stor.no-ip.org> (Magnus Henoch's message of "Wed, 08 Jun 2005 23:43:24 +0200")

Magnus Henoch <mange@freemail.hu> writes:

> Nic Ferrier <nferrier@tapsellferrier.co.uk> 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.

How about putting the data in a buffer and using: 

  process-send-region

In respect of sending lots of data, the same problem applies when
using either threads or async. Consider the example of the text of the
play The Tempest to a network process.

The user can kill the buffer, alter the buffer, delete bits from the
buffer, all while the transfer is going on. So the only way to achieve
this is to lock the buffer first.


>> 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)))

I was trying to be amusing. Asynchronous code is much harder to write
than threaded code, hence threaded code is for beginners.


Nic

  reply	other threads:[~2005-06-08 22:26 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-07  2:22 Threads in emacs implementation Denis Bueno
2005-06-07  2:52 ` Miles Bader
2005-06-07  2:59   ` Denis Bueno
2005-06-07  4:26     ` Miles Bader
2005-06-07  5:16 ` Ken Raeburn
2005-06-07 10:37   ` Nic Ferrier
2005-06-08 12:02   ` Richard Stallman
2005-06-08 18:01 ` Magnus Henoch
2005-06-08 19:52   ` Nic Ferrier
2005-06-08 20:23     ` jhd
2005-06-08 20:47       ` Nic Ferrier
2005-06-08 22:50         ` Stefan Monnier
2005-06-08 21:43     ` Magnus Henoch
2005-06-08 22:26       ` Nic Ferrier [this message]
2005-06-08 22:34       ` hidden buffers for async (was Re: Threads in emacs implementation) Nic Ferrier
2005-06-08 23:36         ` Miles Bader
2005-06-10  0:13         ` Richard Stallman
2005-06-10  1:15           ` hidden buffers for async Nic Ferrier
2005-06-10  1:32             ` Luc Teirlinck
2005-06-10  1:59               ` Nic Ferrier
2005-06-10 22:37             ` Richard Stallman
2005-06-11 20:26               ` Nic Ferrier
2005-06-11 21:05                 ` Henrik Enberg
2005-06-12 10:30                 ` Richard Stallman
2005-06-12 19:48                   ` Nic Ferrier
2005-06-13 15:03                     ` Richard Stallman
2005-06-12 17:18                 ` Stefan Monnier
2005-06-13  6:03                   ` Juri Linkov
2005-06-09 14:41       ` Threads in emacs implementation Richard Stallman
2005-06-09 14:40   ` Richard Stallman
2005-06-10 19:09     ` Ted Zlatanov
2005-06-11  3:48       ` Masatake YAMATO
2005-06-11 12:18       ` Richard Stallman
2005-06-15 15:59         ` Ted Zlatanov
2005-06-15 23:26           ` Miles Bader
2005-06-16 16:25             ` Ted Zlatanov
2005-06-17  0:56               ` Miles Bader
2005-06-17 14:09                 ` Ted Zlatanov
2005-06-17 18:47                   ` Richard Stallman
2005-06-20 18:04                     ` Ted Zlatanov
2005-06-21 15:13                       ` Richard M. Stallman
2005-06-21 18:36                         ` Nic Ferrier
2005-06-22  3:40                           ` Richard M. Stallman
2005-06-20  2:11                   ` Miles Bader
2005-06-20 10:28                     ` Nic Ferrier
2005-06-20 11:19                       ` Lennart Borgman
2005-06-20 11:48                       ` David Kastrup
2005-06-20 12:07                         ` Nic Ferrier
2005-06-20 17:52                     ` Ted Zlatanov
  -- strict thread matches above, loose matches on Subject: below --
2005-06-08  8:24 tomas
2005-06-09  0:29 Steven Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mzq0a3k5.fsf@kanga.tapsellferrier.co.uk \
    --to=nferrier@tapsellferrier.co.uk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).