diff options
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbthread.h | 28 |
2 files changed, 10 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dff515d..008208e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,13 @@ 2019-01-23 Pedro Alves <palves@redhat.com> Andrew Burgess <andrew.burgess@embecosm.com> + * gdbthread.h: Include "common/forward-scope-exit.h". + (scoped_finish_thread_state): Redefine custom class in terms of + forward_scope_exit. + +2019-01-23 Pedro Alves <palves@redhat.com> + Andrew Burgess <andrew.burgess@embecosm.com> + * common/forward-scope-exit.h: New file. 2019-01-23 Pedro Alves <palves@redhat.com> diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 95db696..c35a54e 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -32,6 +32,7 @@ struct symtab; #include "cli/cli-utils.h" #include "common/refcounted-object.h" #include "common-gdbthread.h" +#include "common/forward-scope-exit.h" struct inferior; @@ -612,31 +613,8 @@ extern void finish_thread_state (ptid_t ptid); /* Calls finish_thread_state on scope exit, unless release() is called to disengage. */ -class scoped_finish_thread_state -{ -public: - explicit scoped_finish_thread_state (ptid_t ptid) - : m_ptid (ptid) - {} - - ~scoped_finish_thread_state () - { - if (!m_released) - finish_thread_state (m_ptid); - } - - /* Disengage. */ - void release () - { - m_released = true; - } - - DISABLE_COPY_AND_ASSIGN (scoped_finish_thread_state); - -private: - bool m_released = false; - ptid_t m_ptid; -}; +using scoped_finish_thread_state + = FORWARD_SCOPE_EXIT (finish_thread_state); /* Commands with a prefix of `thread'. */ extern struct cmd_list_element *thread_cmd_list; |