MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / get_current_thread_id

Function get_current_thread_id

_pydevd_bundle/pydevd_constants.py:649–666  ·  view source on GitHub ↗

Note: the difference from get_current_thread_id to get_thread_id is that for the current thread we can get the thread id while the thread.ident is still not set in the Thread instance.

(thread)

Source from the content-addressed store, hash-verified

647
648
649def get_current_thread_id(thread):
650 """
651 Note: the difference from get_current_thread_id to get_thread_id is that
652 for the current thread we can get the thread id while the thread.ident
653 is still not set in the Thread instance.
654 """
655 try:
656 # Fast path without getting lock.
657 tid = thread.__pydevd_id__
658 if tid is None:
659 # Fix for https://www.brainwy.com/tracker/PyDev/645
660 # if __pydevd_id__ is None, recalculate it... also, use an heuristic
661 # that gives us always the same id for the thread (using thread.ident or id(thread)).
662 raise AttributeError()
663 except AttributeError:
664 tid = _get_or_compute_thread_id_with_lock(thread, is_current_thread=True)
665
666 return tid
667
668
669def get_thread_id(thread):

Callers 13

do_wait_suspendMethod · 0.90
_do_wait_suspendMethod · 0.90
runMethod · 0.90
wait_for_commandsMethod · 0.90
request_stackMethod · 0.90
__call__Method · 0.90
dump_framesFunction · 0.90
getVariableFunction · 0.90
add_custom_frameFunction · 0.90
test_find_threadFunction · 0.90

Tested by 1

test_find_threadFunction · 0.72