[Piglit] [Patch V2] Simplify piglit threading
Kenneth Graunke
kenneth at whitecape.org
Thu Jan 9 17:34:49 PST 2014
On 01/08/2014 03:49 PM, Dylan Baker wrote:
> This patch simplifies threading in piglit by removing the hand-rolled
> threadpool, and instead using the Pool class from multiprocessing.dummy.
> This provides a map interface, allowing for very clear succinct code.
>
> The previous implementation ran all tests out of thread pools, a serial
> pool and a multi-threaded pool. This patch does the same thing for a
> couple of reasons. First, the obvious solution is to use the map()
> builtin for serial tests. However, map in python3 returns an iterator
> instead of a list so calling map(f, x) will not actually run f(x) until
> something tries to use those values. This would require considerable
> restructuring to work around. Second, that could easily be split out
> into another patch, and limits the number of changes in this patch.
>
> Multiproccessing.dummy is a wrapper around the Threading module,
> providing the multiproccessing API, but with threads instead of
> processes.
>
> V2: - Renamed run() helper to test()
> - use multiprocessing.dummy.Pool() default thread count value, which
> is equal to multiproccessing.cpu_count(), instead of cpu_count()
> explicitly
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the Piglit
mailing list