We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5af098a commit 15750abCopy full SHA for 15750ab
demos/pool-map.py
@@ -12,6 +12,8 @@ def f(x):
12
# non-blocking alternative
13
result = pool.map_async(f, range(10))
14
while not result.ready():
15
+ print("waiting...")
16
time.sleep(1)
17
+
18
print(result.get())
19
demos/pool.py
@@ -1,4 +1,5 @@
1
from multiprocessing import Pool
2
+import time
3
4
def f(x):
5
return x**2
@@ -11,5 +12,9 @@ def f(x):
11
# Non-blocking execution "in the background"
result = pool.apply_async(f, (12,))
+while not result.ready():
+ time.sleep(1)
print(result.get(timeout=1))
20
0 commit comments