[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter introduction documentation
From: |
Yuan Fu |
Subject: |
Re: Tree-sitter introduction documentation |
Date: |
Mon, 2 Jan 2023 22:58:13 -0800 |
> On Jan 1, 2023, at 4:40 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
>>>>> I think we should default to asynchonous operations as much as possible.
>>>> If you are talking about the whole command, maybe. Does call-process
>>>> automatically yield when ran in a make-thread?
>>> No, it doesn't. And it's threads that yield, not Emacs primitives. A
>>> thread will yield when it calls some API that invokes pselect.
>> Thanks. I guess what I’m asking is that if I run the command in make-thread,
>> will the thread yield when it’s waiting for the subprocess? I tried it and
>> it still blocks Emacs so I guess the answer is no. But maybe I’m doing
>> it wrong.
>
> No, indeed by "asynchronous" I wasn't thinking of using threads, but
> rather using `start-process` and then putting the "rest" into its
> sentinel.
>
> It's rather cumbersome to do, admittedly.
> I have a work-in-progress library of "promises/futures" for Emacs which
> should (eventually) make it easier, but that's not an option for the
> `emacs-29` branch :-(
Oh cool. This would have made some of my packages easier to write :-) I wish
there’s also something like emacs-async: spawn a separate interpreter process,
do some computations and return the result.
Yuan