[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Callbacks from modules
From: |
Ivan Andrus |
Subject: |
Re: Callbacks from modules |
Date: |
Fri, 27 Nov 2015 10:30:41 -0700 |
On Nov 27, 2015, at 1:29 AM, Eli Zaretskii <address@hidden> wrote:
>
>> From: Ivan Andrus <address@hidden>
>> Date: Thu, 26 Nov 2015 20:23:48 -0700
>> Cc: address@hidden
>>
>>> Then one way would be to have that callback set a flag,
>>> provide a Lisp-callable function that returns the flag, and then start
>>> a timer that will test the flag and call your Lisp callback when the
>>> flag is set.
>>
>> I was hoping to avoid polling, since the use case I have would like to start
>> reading again as soon as the previous version finishes.
>
> You could do that on the C level, no? You don't need anything from
> Lisp to start reading again.
I should have said I want the option of continuing to read. I wanted that
logic (along with what to read next) in lisp.
>>> Another, perhaps simpler, possibility would be to have the module
>>> provide a Lisp-callable function that will register a Lisp callback.
>>> Then your C callback will simply call that Lisp function.
>>
>> I don’t understand how I would implement this option, though it sounds like
>> what I was hoping for. In order to call a lisp function, don’t I need an
>> emacs_env?
>
> Forget it, it probably won't work anyway, because your C callback runs
> in another thread, right? Module code cannot run in any thread but
> the main thread.
Okay, I was wondering about that. Based on the back trace it did look like it
was running in the same thread, but it’s probably best to not rely on that.
Thanks,
Ivan
Re: Callbacks from modules, Philipp Stephani, 2015/11/26
Re: Callbacks from modules, Tom Tromey, 2015/11/26
Re: Callbacks from modules, Eli Zaretskii, 2015/11/27
Re: Callbacks from modules, Ted Zlatanov, 2015/11/30
Re: Callbacks from modules, Eli Zaretskii, 2015/11/30