all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: the state of the concurrency branch
@ 2013-10-16 18:24 Barry OReilly
  2013-10-16 20:25 ` Barry OReilly
  0 siblings, 1 reply; 58+ messages in thread
From: Barry OReilly @ 2013-10-16 18:24 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]

> Here's a recipe for reproducing this:
>
>  emacs -Q
>
> Insert this:
>
>    (defvar threads-test-binding nil)
>
>    (defun threads-test-thread2 ()
>      (let ((threads-test-binding 23))
>        (thread-yield))
>      (setq threads-test-global 23))
>
>    (progn
>      (setq threads-test-global nil)
>      (make-thread #'threads-test-thread2)
>      (while (not threads-test-global)
>        (thread-yield))
>      (and (not threads-test-binding)
>           threads-test-global))
>
> Mark the defvar and the defun, type "M-x eval-region RET".  Go to the
> last closing parent of progn, type "C-x C-e", get the expected result
> 23.  All's well till now.
>
> Go to the right paren of the defvar, type "C-x C-e" there.  Now go
> again to the rightmost paren of progn, type "C-x C-e", and get the
> wrong-type-argument error.

If you evaluate the progn enough, it's possible to induce a core dump.

In unbind_for_thread_switch:

  void
  unbind_for_thread_switch (struct thread_state *thr)
  {
    union specbinding *bind;

    for (bind = thr->m_specpdl_ptr; bind != thr->m_specpdl; --bind)
      {
        if (bind->kind >= SPECPDL_LET)
          {
           bind->let.saved_value = find_symbol_value (specpdl_symbol
(bind));
           do_one_unbind (bind, 0);
          }
      }
  }

I find that bind->kind has values like 22 and 105, which are out of
bounds for the enum. Garbage values are one possibility.

When I looked at how other parts of the code iterate over the specpdl,
I find that the iterator decrements from specpdl_ptr first.
Furthermore, the documentation for specpdl_ptr says:

  /* Pointer to first unused element in specpdl.  */

  union specbinding *specpdl_ptr;

So is the solution to decrement bind once before iterating?

[-- Attachment #2: Type: text/html, Size: 2144 bytes --]

^ permalink raw reply	[flat|nested] 58+ messages in thread
* the state of the concurrency branch
@ 2013-08-25 19:26 Tom Tromey
  2013-08-25 19:36 ` Paul Eggert
  2013-08-26 16:48 ` Stefan Monnier
  0 siblings, 2 replies; 58+ messages in thread
From: Tom Tromey @ 2013-08-25 19:26 UTC (permalink / raw)
  To: Emacs discussions

I thought I'd send a note about the concurrency branch.

Referring back to my to-do list from this time last year:

    http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00324.html

I've implemented what I consider the must-have items from that list:

* Documentation
* Condition variables
* Process changes
* Thread switch on select

I've also been periodically merging from trunk and running the test
suite.  This hasn't been too bad; though the changes to specpdl this
year caused a few hiccups.

I've looked a little bit into making it so "emacsclient -t" runs the new
terminal in its own thread.  This is a bit trickier than I thought it
would be; I think it means changing top-level so that it can be entered
by multiple threads, plus making it so that the terminal's fd is
thread-locked.  So, I haven't done this yet.

I haven't written ChangeLog entries yet.


What would it take to merge the branch to trunk?

Tom



^ permalink raw reply	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2013-10-21 18:17 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-16 18:24 the state of the concurrency branch Barry OReilly
2013-10-16 20:25 ` Barry OReilly
2013-10-18  1:41   ` Tom Tromey
2013-10-18  3:32   ` Tom Tromey
2013-10-18 18:13     ` Stefan Monnier
2013-10-18 18:16       ` Tom Tromey
2013-10-19 18:41         ` Richard Stallman
2013-10-19 19:29         ` Barry OReilly
2013-10-19 21:42           ` Stefan Monnier
2013-10-20  0:41             ` Barry OReilly
2013-10-21 15:08             ` Tom Tromey
2013-10-21 16:07               ` Barry OReilly
2013-10-21 18:17                 ` Stefan Monnier
2013-10-21 16:41               ` Stefan Monnier
2013-10-19 20:21         ` Barry OReilly
  -- strict thread matches above, loose matches on Subject: below --
2013-08-25 19:26 Tom Tromey
2013-08-25 19:36 ` Paul Eggert
2013-08-25 19:43   ` Tom Tromey
2013-08-25 20:02     ` Paul Eggert
2013-08-26 14:55       ` Tom Tromey
2013-08-25 20:30     ` Tom Tromey
2013-08-26 16:48 ` Stefan Monnier
2013-08-26 17:04   ` Juanma Barranquero
2013-08-26 17:19     ` Tom Tromey
2013-08-26 18:51     ` Eli Zaretskii
2013-08-26 21:29       ` Stefan Monnier
2013-08-27  2:30         ` Tom Tromey
2013-08-27 16:08           ` Eli Zaretskii
2013-08-27 18:05             ` Paul Eggert
2013-08-27 18:23               ` Tom Tromey
2013-08-27 18:39                 ` Paul Eggert
2013-08-27 18:46                   ` Tom Tromey
2013-08-27 18:52                     ` Paul Eggert
2013-08-27 19:08                       ` Eli Zaretskii
2013-08-27 19:12                         ` Paul Eggert
2013-08-27 18:26               ` Eli Zaretskii
2013-08-27 19:14             ` Tom Tromey
2013-08-27 19:24               ` Eli Zaretskii
2013-08-27 19:29                 ` Tom Tromey
2013-08-28  0:50             ` Stefan Monnier
2013-08-28  4:16               ` Eli Zaretskii
2013-08-28  4:31                 ` Tom Tromey
2013-08-28  4:58                 ` Eli Zaretskii
2013-08-28 13:21                   ` Stefan Monnier
2013-08-28 13:48                     ` Tom Tromey
2013-08-28 14:27                       ` Stefan Monnier
2013-08-28 16:23             ` Eli Zaretskii
2013-08-29  3:54               ` Tom Tromey
2013-08-29 15:10                 ` Eli Zaretskii
2013-08-31  9:57                   ` Eli Zaretskii
2013-08-31 11:51                     ` Eli Zaretskii
2013-08-31 13:42                       ` Eli Zaretskii
2013-09-01 15:49                         ` Eli Zaretskii
2013-09-02 15:27                           ` Eli Zaretskii
2013-08-28  0:45           ` Stefan Monnier
2013-08-28  2:34             ` Tom Tromey
2013-08-27 18:33         ` Tom Tromey
2013-08-28 15:58       ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.