def end(): print prunner.get_dict()['sum']
def sum_up(n): with prunner.global_lock(): prunner.get_dict()['sum'] += n
def begin(): prunner.get_dict()['sum'] = 0 prunner.post_task(init, range(2000))