mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 04:24:43 +00:00
gdbsupport: make gdb::parallel_for_each's n parameter a template parameter
This value will likely never change at runtime, so we might as well make it a template parameter. This has the "advantage" of being able to remove the unnecessary param from gdb::sequential_for_each. Change-Id: Ia172ab8e08964e30d4e3378a95ccfa782abce674 Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
committed by
Simon Marchi
parent
48b60fbfbc
commit
e2f20b221a
@@ -40,10 +40,9 @@ namespace gdb
|
||||
at least N elements processed per thread. Setting N to 0 is not
|
||||
allowed. */
|
||||
|
||||
template<class RandomIt, class RangeFunction>
|
||||
template<std::size_t n, class RandomIt, class RangeFunction>
|
||||
void
|
||||
parallel_for_each (unsigned n, RandomIt first, RandomIt last,
|
||||
RangeFunction callback)
|
||||
parallel_for_each (RandomIt first, RandomIt last, RangeFunction callback)
|
||||
{
|
||||
/* If enabled, print debug info about how the work is distributed across
|
||||
the threads. */
|
||||
@@ -73,7 +72,7 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last,
|
||||
if (parallel_for_each_debug)
|
||||
{
|
||||
debug_printf (_("Parallel for: n_elements: %zu\n"), n_elements);
|
||||
debug_printf (_("Parallel for: minimum elements per thread: %u\n"), n);
|
||||
debug_printf (_("Parallel for: minimum elements per thread: %zu\n"), n);
|
||||
debug_printf (_("Parallel for: elts_per_thread: %zu\n"), elts_per_thread);
|
||||
}
|
||||
|
||||
@@ -141,8 +140,7 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last,
|
||||
|
||||
template<class RandomIt, class RangeFunction>
|
||||
void
|
||||
sequential_for_each (unsigned n, RandomIt first, RandomIt last,
|
||||
RangeFunction callback)
|
||||
sequential_for_each (RandomIt first, RandomIt last, RangeFunction callback)
|
||||
{
|
||||
callback (first, last);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user