[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Releasing the thread global_lock from the module API
From: |
Spencer Baugh |
Subject: |
Re: Releasing the thread global_lock from the module API |
Date: |
Fri, 01 Mar 2024 16:21:03 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eli Zaretskii <eliz@gnu.org> writes:
>> 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?
Yes: I get those things as arguments from Lisp and then convert them
into the native datastructures of my library, which can be used without
further interacting with the Lisp machine.
Then I would release the lock and call into my library, which does some
useful work which takes a while.
> 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.
Yes: After I finish the call into my library, I would take the lock
again and call further Lisp functions to put the results back into the
Lisp machine.
>> 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?
See above: The call into my library, which takes a while, and is useful,
does not touch the Lisp machine. But other code around that call does
touch the Lisp machine, and so needs to run with the lock. The ability
to release and re-acquire the lock means my module doesn't hold the lock
when it doesn't need to.
- Releasing the thread global_lock from the module API, Spencer Baugh, 2024/03/01
- Re: Releasing the thread global_lock from the module API, Eli Zaretskii, 2024/03/01
- Re: Releasing the thread global_lock from the module API, Spencer Baugh, 2024/03/01
- Re: Releasing the thread global_lock from the module API, Eli Zaretskii, 2024/03/01
- Re: Releasing the thread global_lock from the module API, Spencer Baugh, 2024/03/01
- Re: Releasing the thread global_lock from the module API, Eli Zaretskii, 2024/03/01
- Re: Releasing the thread global_lock from the module API, Spencer Baugh, 2024/03/01
- Re: Releasing the thread global_lock from the module API, Eli Zaretskii, 2024/03/01
- Re: Releasing the thread global_lock from the module API,
Spencer Baugh <=
- Re: Releasing the thread global_lock from the module API, Eli Zaretskii, 2024/03/01
- Re: Releasing the thread global_lock from the module API, Spencer Baugh, 2024/03/02
- Re: Releasing the thread global_lock from the module API, Eli Zaretskii, 2024/03/02
- Re: Releasing the thread global_lock from the module API, sbaugh, 2024/03/02
- Re: Releasing the thread global_lock from the module API, Eli Zaretskii, 2024/03/02
- Re: Releasing the thread global_lock from the module API, Spencer Baugh, 2024/03/02
- Re: Releasing the thread global_lock from the module API, Eli Zaretskii, 2024/03/03
- Re: Releasing the thread global_lock from the module API, sbaugh, 2024/03/03
- Re: Releasing the thread global_lock from the module API, Dmitry Gutov, 2024/03/03
- Re: Releasing the thread global_lock from the module API, Eli Zaretskii, 2024/03/03