(self)
| 65 | """Dictionary from multiprocessing handles to StorageWeakRef.""" |
| 66 | |
| 67 | def __init__(self) -> None: |
| 68 | # free_dead_references() is called if the len exceeds the current |
| 69 | # limit. The limit scales with the number of remaining live objects. |
| 70 | self.limit = 128 |
| 71 | # `fork` inherits lock state, so in case we fork when the lock is held, |
| 72 | # we register a function to reset the lock to a new object to avoid |
| 73 | # possible deadlocks, following python multiprocessing library design. |
| 74 | self._after_fork() |
| 75 | register_after_fork(self, SharedCache._after_fork) |
| 76 | |
| 77 | def _after_fork(self): |
| 78 | self.lock = threading.Lock() |
nothing calls this directly
no test coverage detected