I noticed that the variable main_thread:
...
/* The main thread. */
static std::thread::id main_thread;
...
has a confusing name and corresponding comment, because it doesn't contain the
main thread, but rather the main thread's std::thread::id.
Fix this by renaming to main_thread_id.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
static std::mutex runnable_mutex;
-/* The main thread. */
+/* The main thread's thread id. */
-static std::thread::id main_thread;
+static std::thread::id main_thread_id;
#endif
is_main_thread ()
{
#if CXX_STD_THREAD
- return std::this_thread::get_id () == main_thread;
+ return std::this_thread::get_id () == main_thread_id;
#else
return true;
#endif
_initialize_run_on_main_thread ()
{
#if CXX_STD_THREAD
- main_thread = std::this_thread::get_id ();
+ main_thread_id = std::this_thread::get_id ();
#endif
runnable_event = make_serial_event ();
add_file_handler (serial_event_fd (runnable_event), run_events, nullptr,