Skip to content

Commit

Permalink
Use map_async and get to avoid a deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Oct 29, 2014
1 parent d684890 commit 1a182a9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,8 @@ def check_requirements(self):
except:
return "unknown (can not use multiprocessing to determine)"
try:
success, msg = p.map(backend_gtk3agg_internal_check, [0])[0]
res = p.map_async(backend_gtk3agg_internal_check, [0])
success, msg = res.get(timeout=5)[0]
except:
success = False
msg = "Could not determine"
Expand Down Expand Up @@ -1852,7 +1853,8 @@ def check_requirements(self):
p = multiprocessing.Pool()
except:
return "unknown (can not use multiprocessing to determine)"
success, msg = p.map(backend_gtk3cairo_internal_check, [0])[0]
res = p.map_async(backend_gtk3cairo_internal_check, [0])
success, msg = res.get(timeout=5)[0]
p.close()
p.join()
if success:
Expand Down Expand Up @@ -1988,7 +1990,8 @@ def check_requirements(self):
else:
# Multiprocessing OK
try:
msg = p.map(self.callback, [self])[0]
res = p.map_async(self.callback, [self])
msg = res.get(timeout=5)[0]
except:
# If we hit an error on multiprocessing raise it
raise
Expand Down

0 comments on commit 1a182a9

Please sign in to comment.