[Top][All Lists]

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

Re: advice needed for multi-threading patch

From: Ken Raeburn
Subject: Re: advice needed for multi-threading patch
Date: Wed, 26 Aug 2009 03:06:38 -0400

On Aug 26, 2009, at 00:38, Tom Tromey wrote:
In particular I've (initially) implemented cooperative multi- threading.


(BTW, my guile-emacs work is also coming along slowly [1], and Guile supports multithreading, though my current variable-binding support isn't thread-safe. OTOH, Daniel Kraft has been working on loading/ compiling basic elisp in Guile, with thread-safe dynamic bindings. We've got some work to do to make these development projects converge though. I hope you and Daniel and I aren't doing redundant work.)

I managed to handle the V* global variables by writing some elisp that
changed every declaration of a variable mentioned in a DEFVAR_LISP [....]

I've written similar elisp code for doing transformations of patterns within the Emacs code -- mostly more localized things like "XCONS (expr)->car" to "XCAR (expr)", but with support for somewhat complex values of "expr" that have to have balanced parens, etc. I wonder if anyone's looking at collecting elisp tools for C refactoring somewhere.

This was pretty simple and non-intrusive, in the sense that it is
totally automated, so I can easily reapply it as Emacs changes.

Same here. It can *look* very intrusive, even pervasive, when the uses are scattered around the source tree, but simple transforms like this aren't as scary as they might look to someone who doesn't recognize what's happening.

... which brings me to my problem.  I'd also like to apply a similar
treatment to buffer-local variables.  However, those do not have
convenient accessor macros, and before starting the laborious task of
wrapping all buffer field accesses, I thought I'd ask for advice.  Is
this a sane way to proceed?  Should I do something different?  Could I
get such a patch in before the rest of this work, just to make my local
divergence smaller?

Should I take this to mean you've already dealt with the buffer-local variables created by make-variable-buffer-local, which don't live in the buffer structure? If so, I wonder if you can make use of those changes, by replacing XBUFFER(b)->thing with SYMBOL_VALUE(Qthing) where Qthing holds a symbol that's marked as buffer-local; then all the changes for the interaction between thread-local and buffer-local bindings would be localized in indirect_variable and friends, which would then have to deal with both Lisp_Misc_Buffer_Objfwd and Lisp_Misc_Buffer_Local_Value. The Guile work I'm doing would also probably benefit from such changes, down the road.

(One change I'm looking at in my Guile work is changing indirect_variable to accept and return Lisp_Objects instead of struct Lisp_Symbol pointers, for better GC safety. I doubt such a change would significantly affect your work, though it may touch on overlapping bits of code.)


[1] http://lists.gnu.org/archive/html/guile-devel/2009-08/ msg00163.html ; I also have a sort of "project page" I wrote up a while back, but it's not quite current.

reply via email to

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