commit | 4643fd624605b7bf7662d0cbae28ce4f7ad9618e | [log] [tgz] |
---|---|---|
author | koder aka kdanilov <kdanilov@mirantis.com> | Tue Feb 10 16:20:13 2015 -0800 |
committer | koder aka kdanilov <kdanilov@mirantis.com> | Wed Feb 11 05:04:04 2015 -0800 |
tree | 29642e90a03028f97fb9bfd033a391a8ee083432 | |
parent | aeb0447273b50747269d5c9a27f6f1be838319f5 [diff] [blame] |
large refactoring, ready to move away from rally
diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..8941ca5 --- /dev/null +++ b/utils.py
@@ -0,0 +1,17 @@ +import multiprocessing + + +def get_barrier(count): + val = multiprocessing.Value('i', count) + cond = multiprocessing.Condition() + + def closure(timeout): + with cond: + val.value -= 1 + if val.value == 0: + cond.notify_all() + else: + cond.wait(timeout) + return val.value == 0 + + return closure