From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Kludge in eval.c Date: Mon, 12 Dec 2016 19:40:34 +0200 Message-ID: <8360mpcagd.fsf@gnu.org> References: <8337hvfs7j.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1481564578 10850 195.159.176.226 (12 Dec 2016 17:42:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Dec 2016 17:42:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 12 18:42:54 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGUcn-00027f-Sv for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 18:42:54 +0100 Original-Received: from localhost ([::1]:60002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGUcs-00020S-43 for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 12:42:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGUa3-0001Gh-A5 for emacs-devel@gnu.org; Mon, 12 Dec 2016 12:40:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGUZy-0004FY-9S for emacs-devel@gnu.org; Mon, 12 Dec 2016 12:40:03 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGUZy-0004FS-67; Mon, 12 Dec 2016 12:39:58 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4760 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cGUZx-00049Y-Fp; Mon, 12 Dec 2016 12:39:57 -0500 In-reply-to: (message from Noam Postavsky on Sun, 11 Dec 2016 13:36:25 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210355 Archived-At: > From: Noam Postavsky > Date: Sun, 11 Dec 2016 13:36:25 -0500 > > > 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. Thanks, please push your v2.