fix pools to use new Queue class

This commit is contained in:
Denis Bilenko
2009-06-22 15:57:01 +07:00
parent 51f9cee438
commit 75143a1b8f

View File

@@ -95,7 +95,7 @@ class Pool(object):
self.current_size -= 1 self.current_size -= 1
return return
if self.channel.sem.balance < 0: if self.waiting():
self.channel.send(item) self.channel.send(item)
else: else:
if self.order_as_stack: if self.order_as_stack:
@@ -116,10 +116,8 @@ class Pool(object):
def waiting(self): def waiting(self):
"""Return the number of routines waiting for a pool item. """Return the number of routines waiting for a pool item.
""" """
if self.channel.sem.balance < 0: return self.channel.waiting()
return -self.channel.sem.balance
return 0
def create(self): def create(self):
"""Generate a new pool item """Generate a new pool item
""" """