forked from Imagelibrary/binutils-gdb
Remove cooked_index_worker::start_reading
I noticed that cooked_index_worker::start_reading isn't really needed. This patch removes it, and also removes the SCOPED_EXIT, in favor of a direct call.
This commit is contained in:
@@ -449,17 +449,6 @@ cooked_index_worker::start ()
|
|||||||
{
|
{
|
||||||
gdb::thread_pool::g_thread_pool->post_task ([=] ()
|
gdb::thread_pool::g_thread_pool->post_task ([=] ()
|
||||||
{
|
{
|
||||||
this->start_reading ();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See cooked-index.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
cooked_index_worker::start_reading ()
|
|
||||||
{
|
|
||||||
SCOPE_EXIT { bfd_thread_cleanup (); };
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
do_reading ();
|
do_reading ();
|
||||||
@@ -469,6 +458,9 @@ cooked_index_worker::start_reading ()
|
|||||||
m_failed = exc;
|
m_failed = exc;
|
||||||
set (cooked_state::CACHE_DONE);
|
set (cooked_state::CACHE_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bfd_thread_cleanup ();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See cooked-index.h. */
|
/* See cooked-index.h. */
|
||||||
@@ -520,7 +512,7 @@ cooked_index_worker::wait (cooked_state desired_state, bool allow_quit)
|
|||||||
|
|
||||||
if (m_failed.has_value ())
|
if (m_failed.has_value ())
|
||||||
{
|
{
|
||||||
/* start_reading failed -- report it. */
|
/* do_reading failed -- report it. */
|
||||||
exception_print (gdb_stderr, *m_failed);
|
exception_print (gdb_stderr, *m_failed);
|
||||||
m_failed.reset ();
|
m_failed.reset ();
|
||||||
return done;
|
return done;
|
||||||
|
|||||||
@@ -534,13 +534,8 @@ protected:
|
|||||||
friend class cooked_index;
|
friend class cooked_index;
|
||||||
void set (cooked_state desired_state);
|
void set (cooked_state desired_state);
|
||||||
|
|
||||||
/* Start reading DWARF. This can be run in a worker thread without
|
/* Helper function that does the work of reading. This must be able
|
||||||
problems. */
|
to be run in a worker thread without problems. */
|
||||||
void start_reading ();
|
|
||||||
|
|
||||||
/* Helper function that does most of the work for start_reading.
|
|
||||||
This must be able to be run in a worker thread without
|
|
||||||
problems. */
|
|
||||||
virtual void do_reading () = 0;
|
virtual void do_reading () = 0;
|
||||||
|
|
||||||
/* A callback that can print stats, if needed. This is called when
|
/* A callback that can print stats, if needed. This is called when
|
||||||
@@ -579,9 +574,9 @@ protected:
|
|||||||
arose during scanning have been reported by 'wait'. This may
|
arose during scanning have been reported by 'wait'. This may
|
||||||
only be modified on the main thread. */
|
only be modified on the main thread. */
|
||||||
bool m_reported = false;
|
bool m_reported = false;
|
||||||
/* If set, an exception occurred during start_reading; in this case
|
/* If set, an exception occurred during reading; in this case the
|
||||||
the scanning is stopped and this exception will later be reported
|
scanning is stopped and this exception will later be reported by
|
||||||
by the 'wait' method. */
|
the 'wait' method. */
|
||||||
std::optional<gdb_exception> m_failed;
|
std::optional<gdb_exception> m_failed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user