def _captureThreadStacks(self):
"""Capture the stacks for all currently running threads.
:return: A list of ``(thread-description, stack)`` tuples. See
`traceback.format_stack` for the format of ``stack``.
"""
threads = {t.ident: t for t in threading.enumerate()}
def describe(ident):
if ident in threads:
return repr(threads[ident])
else:
return "<*Unknown* %d>" % ident
return [
(describe(ident), traceback.format_stack(frame))
for ident, frame in sys._current_frames().items()
]
评论列表
文章目录