diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-02-12 15:25:53 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-02-12 15:25:53 -0500 |
commit | b8460fcb8c320ea6d7449f37f07502d10eb74cd5 (patch) | |
tree | 49eed9555d20693eb01321881204dd9bc45176d1 /src/lisp.h | |
parent | 89bb5a5f357e911aeb0b9f14e8b2f7c5a5fbabf7 (diff) | |
download | emacs-b8460fcb8c320ea6d7449f37f07502d10eb74cd5.tar.gz emacs-b8460fcb8c320ea6d7449f37f07502d10eb74cd5.tar.bz2 emacs-b8460fcb8c320ea6d7449f37f07502d10eb74cd5.zip |
Rewrite thread context switch code (bug#48990)
Make the context switch code handle buffer-local variables more
correctly by reusing the code originally written for `backtrace-eval`.
This has the side benefit of making the `saved_value` field unused.
* src/lisp.h (enum specbind_tag): Remove `saved_value` field.
(rebind_for_thread_switch, unbind_for_thread_switch): Delete decls.
(specpdl_unrewind): Declare function.
* src/eval.c (specpdl_saved_value): Delete function.
(specbind): Delete the code related to `saved_value`, and consolidate
common code between the different branches.
(rebind_for_thread_switch, -unbind_for_thread_switch): Move to `thread.c`.
(specpdl_unrewind): New function, extracted from `backtrace_eval_unrewind`.
Use `SET_INTERNAL_THREAD_SWITCH`. Skip the buffer & excursion unwinds
depending on new arg `vars_only`.
(backtrace_eval_unrewind): Use it.
(mark_specpdl): Don't mark `saved_value`.
* src/thread.c (rebind_for_thread_switch, unbind_for_thread_switch):
Move from `eval.c` and rewrite using `specpdl_unrewind`.
* test/src/thread-tests.el (threads-test-bug48990): New test.
* test/Makefile.in (test_template): Add a + as suggested by make:
"warning: jobserver unavailable: using -j1. Add '+' to parent make rule".
Diffstat (limited to 'src/lisp.h')
-rw-r--r-- | src/lisp.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/lisp.h b/src/lisp.h index f27c2ad2dd5..19788ef07cc 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3337,9 +3337,6 @@ union specbinding ENUM_BF (specbind_tag) kind : CHAR_BIT; /* `where' is not used in the case of SPECPDL_LET. */ Lisp_Object symbol, old_value, where; - /* Normally this is unused; but it is set to the symbol's - current value when a thread is swapped out. */ - Lisp_Object saved_value; } let; struct { ENUM_BF (specbind_tag) kind : CHAR_BIT; @@ -4453,8 +4450,7 @@ extern void set_unwind_protect (specpdl_ref, void (*) (Lisp_Object), Lisp_Object); extern void set_unwind_protect_ptr (specpdl_ref, void (*) (void *), void *); extern Lisp_Object unbind_to (specpdl_ref, Lisp_Object); -extern void rebind_for_thread_switch (void); -extern void unbind_for_thread_switch (struct thread_state *); +void specpdl_unrewind (union specbinding *pdl, int distance, bool vars_only); extern AVOID error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); extern AVOID verror (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); |