[review v3] Introduce run_on_main_thread

Pedro Alves (Code Review) gerrit@gnutoolchain-gerrit.osci.io
Fri Nov 22 18:39:00 GMT 2019


Pedro Alves has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/170
......................................................................


Patch Set 3: Code-Review+2

(2 comments)

| --- gdb/ser-event.c
| +++ gdb/ser-event.c
| @@ -220,0 +228,19 @@ /* The serial event used when posting runnables.  */
| +
| +static struct serial_event *runnable_event;
| +
| +/* Runnables that have been posted.  */
| +
| +static std::vector<std::function<void ()>> runnables;
| +
| +#if CXX_STD_THREAD
| +
| +/* Mutex to hold when handling runnable_event or runnables.  */

PS3, Line 237:

Uppercase runnable_event / runnables ?

| +
| +static std::mutex runnable_mutex;
| +
| +#endif
| +
| +/* Run all the queued runnables.  */
| +
| +static void
| +run_events (int error, gdb_client_data client_data)
| --- /dev/null
| +++ gdb/unittests/main-thread-selftests.c
| @@ -1,0 +68,13 @@ run_tests ()
| +#endif
| +
| +}
| +}
| +
| +void
| +_initialize_main_thread_selftests ()
| +{
| +#if CXX_STD_THREAD
| +  selftests::register_test ("main_thread",

PS3, Line 77:

Any reason this isn't named "run_on_main_thread"?

Just thinking about whether that would make "maint info selftests"
output more obvious.  I imagine that that command could have a
completer and "maint info selftests run_on<TAB>" would be the obvious
thing to typo.

Actually, this is so minor that I don't know why I'm mentioning it.
Please ignore. :-D

Thanks much for adding the unit test.

| +			    selftests::main_thread_tests::run_tests);
| +#endif
| +}

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I16ef82f0564e9f8a524bdc64cb31df79a988ad9f
Gerrit-Change-Number: 170
Gerrit-PatchSet: 3
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Pedro Alves <palves@redhat.com>
Gerrit-Comment-Date: Fri, 22 Nov 2019 18:38:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment



More information about the Gdb-patches mailing list