Hoist code on marking thread as exited
This patch hoists code on marking thread as exited, so more code is shared for two different paths (thread_info is deleted or is not deleted). gdb: 2017-04-10 Yao Qi <yao.qi@linaro.org> * thread.c (delete_thread_1): Hoist code on marking thread as exited.
This commit is contained in:
parent
947fa91414
commit
8c25b49760
|
@ -1,3 +1,8 @@
|
||||||
|
2017-04-10 Yao Qi <yao.qi@linaro.org>
|
||||||
|
|
||||||
|
* thread.c (delete_thread_1): Hoist code on marking thread as
|
||||||
|
exited.
|
||||||
|
|
||||||
2017-04-09 Simon Marchi <simon.marchi@polymtl.ca>
|
2017-04-09 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
* windows-nat.c (windows_detach): Initialize ptid with
|
* windows-nat.c (windows_detach): Initialize ptid with
|
||||||
|
|
33
gdb/thread.c
33
gdb/thread.c
|
@ -434,35 +434,26 @@ delete_thread_1 (ptid_t ptid, int silent)
|
||||||
if (tp->step_over_next != NULL)
|
if (tp->step_over_next != NULL)
|
||||||
thread_step_over_chain_remove (tp);
|
thread_step_over_chain_remove (tp);
|
||||||
|
|
||||||
|
if (tp->state != THREAD_EXITED)
|
||||||
|
{
|
||||||
|
observer_notify_thread_exit (tp, silent);
|
||||||
|
|
||||||
|
/* Tag it as exited. */
|
||||||
|
tp->state = THREAD_EXITED;
|
||||||
|
|
||||||
|
/* Clear breakpoints, etc. associated with this thread. */
|
||||||
|
clear_thread_inferior_resources (tp);
|
||||||
|
}
|
||||||
|
|
||||||
/* If this is the current thread, or there's code out there that
|
/* If this is the current thread, or there's code out there that
|
||||||
relies on it existing (refcount > 0) we can't delete yet. Mark
|
relies on it existing (refcount > 0) we can't delete yet. */
|
||||||
it as exited, and notify it. */
|
|
||||||
if (tp->refcount > 0
|
if (tp->refcount > 0
|
||||||
|| ptid_equal (tp->ptid, inferior_ptid))
|
|| ptid_equal (tp->ptid, inferior_ptid))
|
||||||
{
|
{
|
||||||
if (tp->state != THREAD_EXITED)
|
|
||||||
{
|
|
||||||
observer_notify_thread_exit (tp, silent);
|
|
||||||
|
|
||||||
/* Tag it as exited. */
|
|
||||||
tp->state = THREAD_EXITED;
|
|
||||||
|
|
||||||
/* Clear breakpoints, etc. associated with this thread. */
|
|
||||||
clear_thread_inferior_resources (tp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Will be really deleted some other time. */
|
/* Will be really deleted some other time. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notify thread exit, but only if we haven't already. */
|
|
||||||
if (tp->state != THREAD_EXITED)
|
|
||||||
observer_notify_thread_exit (tp, silent);
|
|
||||||
|
|
||||||
/* Tag it as exited. */
|
|
||||||
tp->state = THREAD_EXITED;
|
|
||||||
clear_thread_inferior_resources (tp);
|
|
||||||
|
|
||||||
if (tpprev)
|
if (tpprev)
|
||||||
tpprev->next = tp->next;
|
tpprev->next = tp->next;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue