]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdbserver/linux-low.cc
Use find_thread_in_random in select_event_lwp
authorTom Tromey <tromey@adacore.com>
Thu, 4 Apr 2019 22:57:11 +0000 (16:57 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 9 Apr 2019 18:03:25 +0000 (12:03 -0600)
commitb0319eaaf9d1f4e730c532058f2fff0b4e5ce682
tree5232bf0ddc163b3a58e536e74f514c1c7f574f92
parent9ab8741a48294e19d514721c710c81bba46db7f2
Use find_thread_in_random in select_event_lwp

I noticed that find_thread_in_random duplicates the code in
find_thread_in_random, so this patch changes the latter to use the
former.

There are two other spots in gdb that do this, but to unify all of
them would require switching some code from using the "iterate over"
idiom to using iterators.

Another possible improvement is that find_thread_in_random could be
made single-pass using reservoir sampling.

Tested by the buildbot.

gdb/gdbserver/ChangeLog
2019-04-09  Tom Tromey  <tromey@adacore.com>

* linux-low.c (select_event_lwp): Use find_thread_in_random.
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c