thread-safe singelton in python

avi410virkram 3 years ago 0

The thread-safe singleton described has one slight issue:
Since the lock is a class variable, if one Singleton class tried to instantiate another singleton class ... it leads to a deadlock. I think it will be better to move this lock inside __call__ and instantiate it every time before instantiating an object