emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Kludge in eval.c


From: Noam Postavsky
Subject: Re: Kludge in eval.c
Date: Sun, 11 Dec 2016 13:36:25 -0500

On Sat, Dec 10, 2016 at 3:24 PM, Eli Zaretskii <address@hidden> wrote:
>
> When I worked on merging the concurrency branch, I bumped into a
> problem with the recently introduced watcher feature.  The problem is
> that variables can have thread-local bindings, so when there's a
> thread switch, Emacs needs to rebind those variables to the values
> they have in the new thread.  If such a variable is marked as
> trap-write, rebinding would normally call the watchers, which I think
> is not what we want.  Do you agree?

Yes, I agree. The fact that thread-local values are implemented by
rebinding is a C level implementation detail that shouldn't leak into
Lisp code.

>
> If you agree, then we need a way of bypassing the watchers call when
> the rebinding is due to a thread switch.  In the merged concurrency
> code I used a semi-kludgey solution for that, see the two FIXMEs I
> left behind, in rebind_for_thread_switch and unbind_for_thread_switch.
> Could you please look at that and suggest a cleaner solution?
>

The easiest is adding a global flag, but after doing that, I realized
adding a parameter to set_internal and friends isn't too much trouble.
So my suggestion is the attached v2 patch, I've included the v1 for
comparison, since I had written it already anyway.

Attachment: v1-0001-Clean-up-var-watcher-disabling-on-thread-switchin.patch
Description: Text Data

Attachment: v2-0001-Clean-up-var-watcher-disabling-on-thread-switchin.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]