Author: Remi Meier <remi.me...@inf.ethz.ch> Branch: Changeset: r252:f232348bc821 Date: 2014-04-24 13:18 +0200 http://bitbucket.org/pypy/benchmarks/changeset/f232348bc821/
Log: shutdown thread pools at the end of benchmark runs diff --git a/multithread/btree/btree.py b/multithread/btree/btree.py --- a/multithread/btree/btree.py +++ b/multithread/btree/btree.py @@ -347,6 +347,9 @@ # print "tree:" # print tree + # shutdown current pool + set_thread_pool(None) + diff --git a/multithread/common/abstract_threading.py b/multithread/common/abstract_threading.py --- a/multithread/common/abstract_threading.py +++ b/multithread/common/abstract_threading.py @@ -49,6 +49,8 @@ def set_thread_pool(th): global _thread_pool + if _thread_pool: + _thread_pool.shutdown() _thread_pool = th diff --git a/multithread/mandelbrot/mandelbrot.py b/multithread/mandelbrot/mandelbrot.py --- a/multithread/mandelbrot/mandelbrot.py +++ b/multithread/mandelbrot/mandelbrot.py @@ -1,4 +1,4 @@ -from common.abstract_threading import Future, atomic +from common.abstract_threading import atomic, Future, set_thread_pool, ThreadPool import sys @@ -59,6 +59,7 @@ br, bi = 1.0, 1.5 width, height = 4096, 4096 + set_thread_pool(ThreadPool(threads)) step = (bi - ai) / threads res = [] ai = -1.5 @@ -71,6 +72,8 @@ )) res = [f() for f in res] + + set_thread_pool(None) return merge_imgs(res) diff --git a/multithread/raytrace/raytrace.py b/multithread/raytrace/raytrace.py --- a/multithread/raytrace/raytrace.py +++ b/multithread/raytrace/raytrace.py @@ -165,6 +165,10 @@ print f() del futures[:] + # shutdown current pool + set_thread_pool(None) + + if __name__ == '__main__': run() diff --git a/multithread/skiplist/skiplist.py b/multithread/skiplist/skiplist.py --- a/multithread/skiplist/skiplist.py +++ b/multithread/skiplist/skiplist.py @@ -130,6 +130,10 @@ # print "list:" # slist.printList() + # shutdown current pool + set_thread_pool(None) + + _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit