From: Eli Zaretskii <eliz@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [RFC] Adding threads to Eshell
Date: Fri, 16 Dec 2022 21:51:24 +0200 [thread overview]
Message-ID: <83mt7ni0ub.fsf@gnu.org> (raw)
In-Reply-To: <7f4e3357-2c6a-a0d2-cab5-fb641b52877a@gmail.com> (message from Jim Porter on Thu, 15 Dec 2022 18:37:09 -0800)
> Date: Thu, 15 Dec 2022 18:37:09 -0800
> From: Jim Porter <jporterbugs@gmail.com>
>
> However, before I go too far, I wanted to check with other, more
> knowledgeable people: are Emacs threads available on all platforms?
Yes. The only known exception is MSDOS.
> It looks like it requires the pthreads library
pthreads are required only on Posix platforms; on Windows we use
Windows-specific APIs instead. See systhread.c.
> (though my understanding was
> that Emacs threads aren't "real" threads, since there's no good way to
> avoid data races with globals).
No, they are real threads. You can see them with any OS-level tool
that can examine threads. We just let only a single one of these
threads to run at any given time (well, with the exception of very
short time windows).
> A second issue I noticed is that Emacs threads have their own,
> completely separate set of lexical bindings.
Not lexical bindings: local bindings. That is, if you let-bind a
variable, that binding is only seen in the thread that performed the
binding.
> Is it possible to tell a thread that I want to inherit the bindings
> from wherever I called 'make-thread'?
Global bindings are always shared.
> I might be able to avoid this issue, but it would be nice to be able
> to let-bind some defvars and then pass those bindings to an Eshell
> command to do its thing.
If that is what you want, you will have to pass those bindings as
arguments to the thread function.
next prev parent reply other threads:[~2022-12-16 19:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 2:37 [RFC] Adding threads to Eshell Jim Porter
2022-12-16 14:05 ` Stefan Monnier
2022-12-16 20:11 ` Jim Porter
2022-12-17 3:40 ` Stefan Monnier
2022-12-17 5:19 ` Jim Porter
2022-12-16 19:51 ` Eli Zaretskii [this message]
2022-12-16 20:25 ` Jim Porter
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=83mt7ni0ub.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jporterbugs@gmail.com \
/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.