Index: tools/binary_size/libsupersize/helpers.py |
diff --git a/tools/binary_size/libsupersize/helpers.py b/tools/binary_size/libsupersize/helpers.py |
index 4379f82dbbe2fea7796d4bfc79538c211b99e957..bddcd76479f26e71ea8ea3bcd867eb72bcca4b9d 100644 |
--- a/tools/binary_size/libsupersize/helpers.py |
+++ b/tools/binary_size/libsupersize/helpers.py |
@@ -4,40 +4,8 @@ |
"""Utility methods.""" |
-import atexit |
-import multiprocessing |
import os |
-import threading |
SRC_ROOT = os.path.dirname( |
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) |
- |
- |
-def MakeProcessPool(*args): |
- """Wrapper for multiprocessing.Pool, with fix to terminate on exit.""" |
- ret = multiprocessing.Pool(*args) |
- def close_pool(): |
- ret.terminate() |
- |
- def on_exit(): |
- thread = threading.Thread(target=close_pool) |
- thread.daemon = True |
- thread.start() |
- |
- # Without calling terminate() on a separate thread, the call can block |
- # forever. |
- atexit.register(on_exit) |
- return ret |
- |
- |
-def ForkAndCall(func, *args, **kwargs): |
- """Uses multiprocessing to run the given function in a fork'ed process. |
- |
- Returns: |
- A Result object (call .get() to get the return value) |
- """ |
- pool_of_one = MakeProcessPool(1) |
- result = pool_of_one.apply_async(func, args=args, kwds=kwargs) |
- pool_of_one.close() |
- return result |