all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: emacs-devel@gnu.org
Subject: Re: Releasing the thread global_lock from the module API
Date: Fri, 01 Mar 2024 22:42:44 +0200	[thread overview]
Message-ID: <865xy5r8e3.fsf@gnu.org> (raw)
In-Reply-To: <ierzfvhspcq.fsf@janestreet.com> (message from Spencer Baugh on Fri, 01 Mar 2024 14:51:01 -0500)

> From: Spencer Baugh <sbaugh@janestreet.com>
> Date: Fri, 01 Mar 2024 14:51:01 -0500
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > There's very little you can do usefully this way without touching some
> > aspect of the Lisp machine.  Assuming that what you do has some
> > relevance to the Emacs session, of course.
> 
> Actually, there is lots of useful stuff that can be done this way.
> 
> For example, if a C library internally opens a network socket and sends
> a request to a network service, that does not touch the Lisp machine and
> so can be done this way.
> 
> Is that not useful?  Or do these touch the Lisp machine in some way I
> don't know about?

Where would you take the data for opening the socket? doesn't that
come from some Lisp program or from a Lisp variable?  And how would
you know what kind of request to send? doesn't that come from Lisp as
well?  And what would you do with the stuff you get in response? don't
you want to put this in some Lisp variable or provide as input for
some Lisp program?  Etc. etc.

> Since it's useful for me, I'd like to write a patch which allow modules
> to do this; would it be considered?

Once again: what cannot you do from a native thread started by the
module?  IOW, why would you need access to the global lock machinery
in the first place, if all you want to do is something that is
unrelated to Emacs and its global state?

The code which manipulates the global lock is extremely fragile, so
exposing this to external agents without a very good reason and
without being able to fore some discipline is a bad idea.  And I don't
yet see such a good reason, let alone how to do that in a way that
will preserve the discipline of taking and releasing the lock.  So
please do try to explain better why native threads that are unrelated
to the lock are not the solution for what you have in mind.



  reply	other threads:[~2024-03-01 20:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 14:53 Releasing the thread global_lock from the module API Spencer Baugh
2024-03-01 16:47 ` Eli Zaretskii
2024-03-01 17:34   ` Spencer Baugh
2024-03-01 18:44     ` Eli Zaretskii
2024-03-01 19:02       ` Spencer Baugh
2024-03-01 19:26         ` Eli Zaretskii
2024-03-01 19:51           ` Spencer Baugh
2024-03-01 20:42             ` Eli Zaretskii [this message]
2024-03-01 21:21               ` Spencer Baugh
2024-03-01 21:34                 ` Eli Zaretskii
2024-03-01 21:56                   ` Spencer Baugh
2024-03-02  6:43                     ` Eli Zaretskii
2024-03-02 16:39                       ` sbaugh
2024-03-02 17:02                         ` Eli Zaretskii
2024-03-02 20:33                           ` Spencer Baugh
2024-03-03  6:13                             ` Eli Zaretskii
2024-03-03 13:19                               ` sbaugh
2024-03-03 15:42                                 ` Dmitry Gutov
2024-03-03 15:51                                 ` Eli Zaretskii
2024-03-01 19:30     ` tomas
2024-03-01 23:53       ` Dmitry Gutov
2024-03-02  5:57         ` tomas
2024-03-02 15:35           ` Dmitry Gutov
2024-03-02 16:31             ` tomas
2024-03-02 21:41               ` sbaugh
2024-03-03  6:25                 ` tomas

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=865xy5r8e3.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=sbaugh@janestreet.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.