blob: 8941ca599265d1428f9cf6167e8eae0d99615425 [file] [log] [blame]
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