use context manager around condition in as_completed
@@ -3069,9 +3069,8 @@ class as_completed(object):
while self.queue.empty():
if not self.futures:
raise StopIteration()
- self.th_condition.acquire()
+ with self.th_condition:
self.th_condition.wait()
- self.th_condition.release()
return self.queue.get()
@gen.coroutine
