| Index: tools/binary_size/libsupersize/helpers.py
|
| diff --git a/tools/binary_size/libsupersize/helpers.py b/tools/binary_size/libsupersize/helpers.py
|
| index bddcd76479f26e71ea8ea3bcd867eb72bcca4b9d..bfeef034e13c4c44534180ad6bc2b255748b1586 100644
|
| --- a/tools/binary_size/libsupersize/helpers.py
|
| +++ b/tools/binary_size/libsupersize/helpers.py
|
| @@ -4,8 +4,21 @@
|
|
|
| """Utility methods."""
|
|
|
| +import multiprocessing
|
| import os
|
|
|
|
|
| SRC_ROOT = os.path.dirname(
|
| os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
| +
|
| +
|
| +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 = multiprocessing.Pool(1)
|
| + result = pool_of_one.apply_async(func, args=args, kwds=kwargs)
|
| + pool_of_one.close()
|
| + return result
|
|
|