From: Daniel Pittman <daniel@rimspace.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Asynchronously downloading a file
Date: Fri, 02 Jul 2010 19:06:23 +1000 [thread overview]
Message-ID: <87sk42jlrk.fsf@rimspace.net> (raw)
In-Reply-To: m2vd8yjstp.wl%Mcknight@Qiang-Guos-MacBook-Pro.local
Qiang Guo <mcknight0219@gmail.com> writes:
> Emacs adheres to single thread fervently, so it may be impossible to do this
> within emacs.
That isn't actually all that true: while there is only a single thread of
execution within Emacs you can address this in one of two ways:
The obvious, and sane, way is to take advantage of the event-driven I/O
functionality present in Emacs as part of the process / network-connection
filter infrastructure.
In this mode you tell the system to start the download, then your function is
called (or data collected in a buffer) as it is available to be read. While
there is only a single thread, this will jump over to handling your download
transparently to doing other activities.
The second way is to use an external process to do the same; you can even
invoke 'emacs --batch --eval' if you really want to. :)
Daniel
The second way is kind of wasteful given that `open-network-stream' is
actually entirely asynchronous and all.
--
✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons
next prev parent reply other threads:[~2010-07-02 9:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-01 21:43 Asynchronously downloading a file Deniz Dogan
2010-07-02 6:33 ` Qiang Guo
2010-07-02 9:04 ` Deniz Dogan
2010-07-02 9:06 ` Daniel Pittman [this message]
2010-07-02 9:22 ` Deniz Dogan
2010-07-02 9:46 ` Daniel Pittman
2010-07-02 10:11 ` Deniz Dogan
2010-07-02 10:16 ` Lennart Borgman
2010-07-02 7:41 ` David Engster
2010-07-02 9:23 ` Alberto Luaces
[not found] ` <mailman.5.1278062489.22038.help-gnu-emacs@gnu.org>
2010-07-02 9:24 ` Andreas Politz
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sk42jlrk.fsf@rimspace.net \
--to=daniel@rimspace.net \
--cc=help-gnu-emacs@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.