unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: emacs-devel@gnu.org
Subject: Re: Example of threads and concurrency?
Date: Sun, 19 Feb 2017 18:02:57 +0200	[thread overview]
Message-ID: <83o9xyp3ri.fsf@gnu.org> (raw)
In-Reply-To: <87o9xz1bc9.fsf@ericabrahamsen.net> (message from Eric Abrahamsen on Sat, 18 Feb 2017 12:40:54 -0800)

> From: Eric Abrahamsen <eric@ericabrahamsen.net>
> Date: Sat, 18 Feb 2017 12:40:54 -0800
> 
> In my dumb example I had indeed expected to use accept-process-output.
> But there's not a whole lot of advantage of using threads plus
> accept-process-output over just using start|make-process with sentinels
> and callbacks, right?

It depends on what your network- or process-related code needs to do.
If it just reads whatever the process has to give and that's all, then
indeed, these two methods are roughly equivalent.  But if it has some
more complex processing, like waiting for the process, dealing with
errors, interacting with it, etc., then running that in a separate
thread can make your code much simpler and easier to write, while
letting the main thread (and thus the user) go about its business.



  reply	other threads:[~2017-02-19 16:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87tw81sudh.fsf@ericabrahamsen.net>
2017-02-18 18:43 ` Example of threads and concurrency? Eric Abrahamsen
2017-02-18 19:23   ` Noam Postavsky
2017-02-18 19:41     ` Eli Zaretskii
2017-02-18 19:43       ` Noam Postavsky
2017-02-18 19:27   ` Eli Zaretskii
2017-02-18 20:40     ` Eric Abrahamsen
2017-02-19 16:02       ` Eli Zaretskii [this message]
2017-02-19 19:50         ` Eric Abrahamsen

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=83o9xyp3ri.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /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).