Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions easypy/threadtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,22 @@ def start_new_thread(target, *args, **kwargs):

def wrapper(*args, **kwargs):
thread = threading.current_thread()
child_uuid = get_thread_uuid(thread)
registry_key = (parent_uuid, child_uuid)

if not DISABLE_ACROSS_THREADS:
_FRAME_SNAPSHOTS_REGISTRY[parent_thread.uuid, thread.uuid] = create_frame_snapshot(parent_frame, parent_thread)
uuid = get_thread_uuid(thread)
UUIDS_TREE[uuid] = parent_uuid
_FRAME_SNAPSHOTS_REGISTRY[registry_key] = create_frame_snapshot(parent_frame, parent_thread)

UUIDS_TREE[child_uuid] = parent_uuid
if _REGISTER_GREENLETS:
IDENT_TO_GREENLET[thread.ident] = gevent.getcurrent()
try:
return target(*args, **kwargs)
finally:
# remove the snapshot connecting parent → this thread
_FRAME_SNAPSHOTS_REGISTRY.pop((parent_thread.uuid, thread.uuid), None)
_FRAME_SNAPSHOTS_REGISTRY.pop(registry_key, None)

IDENT_TO_UUID.pop(thread.ident)
IDENT_TO_UUID.pop(thread.ident, None)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this added?


return _orig_start_new_thread(wrapper, *args, **kwargs)

Expand Down