()
| 231 | _afterfork_counter = itertools.count() |
| 232 | |
| 233 | def _run_after_forkers(): |
| 234 | items = list(_afterfork_registry.items()) |
| 235 | items.sort() |
| 236 | for (index, ident, func), obj in items: |
| 237 | try: |
| 238 | func(obj) |
| 239 | except Exception as e: |
| 240 | info('after forker raised exception %s', e) |
| 241 | |
| 242 | def register_after_fork(obj, func): |
| 243 | _afterfork_registry[(next(_afterfork_counter), id(obj), func)] = obj |