Fix for waitall with nothing running
This commit is contained in:
@@ -119,7 +119,8 @@ class GreenPool(object):
|
||||
|
||||
def waitall(self):
|
||||
"""Waits until all greenthreads in the pool are finished working."""
|
||||
self.no_coros_running.wait()
|
||||
if self.running():
|
||||
self.no_coros_running.wait()
|
||||
|
||||
def _spawn_done(self, coro):
|
||||
self.sem.release()
|
||||
|
@@ -298,6 +298,11 @@ class GreenPool(tests.LimitedTestCase):
|
||||
result_list = list(p.starmap(passthru, [(x,) for x in xrange(10)]))
|
||||
self.assertEquals(result_list, range(10))
|
||||
|
||||
def test_waitall_on_nothing(self):
|
||||
p = greenpool.GreenPool()
|
||||
p.waitall()
|
||||
|
||||
|
||||
class GreenPile(tests.LimitedTestCase):
|
||||
def test_pile(self):
|
||||
p = greenpool.GreenPile(4)
|
||||
|
Reference in New Issue
Block a user