|
From: | Jim Porter |
Subject: | Re: [RFC] Adding threads to Eshell |
Date: | Fri, 16 Dec 2022 12:25:57 -0800 |
On 12/16/2022 11:51 AM, Eli Zaretskii wrote:
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.
Ok, so it looks like MSDOS is also the only platform that lacks support for async subprocesses. In that case, I think it would be ok to require threads for Eshell if you want to execute commands asynchronously.
It looks like it requires the pthreads librarypthreads are required only on Posix platforms; on Windows we use Windows-specific APIs instead. See systhread.c.
Ah ha. I had somehow gotten it into my head that Emacs used pthread wrappers on Win32.
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).
Oh, ok. I don't think that will make anything harder to implement though, so no worries there.
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.
Like I said in my message to Stefan, I'm not totally sure if this is the right way to go, but I want to experiment with it a bit more. It doesn't look too hard to pass those bindings in once I have them, but I don't know of a good way to get the list of all local bindings of dynamic variables in the first place.
[Prev in Thread] | Current Thread | [Next in Thread] |