fix for pool cleanup

This commit is contained in:
Joe Shochet 2006-05-04 21:08:35 +00:00
parent 0223f1cb38
commit c2bcda6260
1 changed files with 4 additions and 3 deletions

View File

@ -101,9 +101,10 @@ class Pool:
cleanupFunc will be called on every free and used item.
"""
if cleanupFunc:
for item in self.__free:
cleanupFunc(item)
for item in self.__used:
# Make a list of all the items first in case the act of
# calling cleanupFunc moves some from used to free.
allItems = self.__free + self.__used
for item in allItems:
cleanupFunc(item)
del self.__free
del self.__used