diff options
| author | Tom Tromey | 2013-07-03 22:00:43 -0600 |
|---|---|---|
| committer | Tom Tromey | 2013-07-03 22:00:43 -0600 |
| commit | 2efa60a37de1602f2c867010b1eddda92211c7ad (patch) | |
| tree | a7629af6d22089ff436fcd6d9498d17eda342331 /src | |
| parent | 39d7c9d51bf0a5d545de37ee668c5cbc17b79589 (diff) | |
| download | emacs-2efa60a37de1602f2c867010b1eddda92211c7ad.tar.gz emacs-2efa60a37de1602f2c867010b1eddda92211c7ad.zip | |
unlink thread later
unlink thread from global list later
also remove some unnecessary destruction code
Diffstat (limited to 'src')
| -rw-r--r-- | src/thread.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/thread.c b/src/thread.c index 361968489c6..8a81a1021a6 100644 --- a/src/thread.c +++ b/src/thread.c | |||
| @@ -645,17 +645,6 @@ run_thread (void *state) | |||
| 645 | 645 | ||
| 646 | update_processes_for_thread_death (Fcurrent_thread ()); | 646 | update_processes_for_thread_death (Fcurrent_thread ()); |
| 647 | 647 | ||
| 648 | /* Unlink this thread from the list of all threads. */ | ||
| 649 | for (iter = &all_threads; *iter != self; iter = &(*iter)->next_thread) | ||
| 650 | ; | ||
| 651 | *iter = (*iter)->next_thread; | ||
| 652 | |||
| 653 | self->m_last_thing_searched = Qnil; | ||
| 654 | self->m_saved_last_thing_searched = Qnil; | ||
| 655 | self->name = Qnil; | ||
| 656 | self->function = Qnil; | ||
| 657 | self->error_symbol = Qnil; | ||
| 658 | self->error_data = Qnil; | ||
| 659 | xfree (self->m_specpdl); | 648 | xfree (self->m_specpdl); |
| 660 | self->m_specpdl = NULL; | 649 | self->m_specpdl = NULL; |
| 661 | self->m_specpdl_ptr = NULL; | 650 | self->m_specpdl_ptr = NULL; |
| @@ -664,6 +653,14 @@ run_thread (void *state) | |||
| 664 | current_thread = NULL; | 653 | current_thread = NULL; |
| 665 | sys_cond_broadcast (&self->thread_condvar); | 654 | sys_cond_broadcast (&self->thread_condvar); |
| 666 | 655 | ||
| 656 | /* Unlink this thread from the list of all threads. Note that we | ||
| 657 | have to do this very late, after broadcasting our death. | ||
| 658 | Otherwise the GC may decide to reap the thread_state object, | ||
| 659 | leading to crashes. */ | ||
| 660 | for (iter = &all_threads; *iter != self; iter = &(*iter)->next_thread) | ||
| 661 | ; | ||
| 662 | *iter = (*iter)->next_thread; | ||
| 663 | |||
| 667 | release_global_lock (); | 664 | release_global_lock (); |
| 668 | 665 | ||
| 669 | return NULL; | 666 | return NULL; |