diff --git a/Chapter15/example3.py b/Chapter15/example3.py index d5b085b..77d1489 100644 --- a/Chapter15/example3.py +++ b/Chapter15/example3.py @@ -43,8 +43,10 @@ def countdown(n): pool = Pool(processes=2) start = time.time() - pool.apply_async(countdown, args=(COUNT//2,)) - pool.apply_async(countdown, args=(COUNT//2,)) + r1 = pool.apply_async(countdown, args=(COUNT//2,)) + r2 = pool.apply_async(countdown, args=(COUNT//2,)) + r1.wait() # it should wait to measure its completion time. + r2.wait() pool.close() pool.join()