Use forward_scope_exit for scoped_finish_thread_state

This reimplements the manually-written scoped_finish_thread_state
class as a forward_scope_exit instantiation.  forward_scope_exit has
the same interface as scoped_finish_thread_state, so nothing else has
to change.

A forward_scope_exit is preferred over make_scope_exit here because
infrun.c:normal_stop needs to wrap scoped_finish_thread_state in a
gdb::optional.  Since we need the type there, might as well use it
everywhere.

gdb/ChangeLog:
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.
2 files changed