Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

__del__ method of utils.ThreadedDict #75

Open
lovelylain opened this Issue · 0 comments

1 participant

@lovelylain

__del__ method of utils.ThreadedDict is not needed or should use weakref instead.
Because ThreadedDict.instances has kept a reference of ThreadedDict instances, the `__del_method will not automatically be called, I also think we should not directly override threading.local'sdel`.
If we use weakref, it can be like this:

_instances = set()

def __init__(self):
    ThreadedDict._instances.add(weakref.ref(self, ThreadedDict._instances.remove))

@staticmethod
def clear_all():
    for d in ThreadedDict._instances:
        d().clear()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.