MCPcopy Index your code
hub / github.com/python/cpython / current_thread

Function current_thread

Lib/threading.py:1463–1473  ·  view source on GitHub ↗

Return the current Thread object, corresponding to the caller's thread of control. If the caller's thread of control was not created through the threading module, a dummy thread object with limited functionality is returned.

()

Source from the content-addressed store, hash-verified

1461# Global API functions
1462
1463def current_thread():
1464 """Return the current Thread object, corresponding to the caller's thread of control.
1465
1466 If the caller's thread of control was not created through the threading
1467 module, a dummy thread object with limited functionality is returned.
1468
1469 """
1470 try:
1471 return _active[get_ident()]
1472 except KeyError:
1473 return _DummyThread()
1474
1475def currentThread():
1476 """Return the current Thread object, corresponding to the caller's thread of control.

Callers 5

get_dictMethod · 0.90
create_dictMethod · 0.90
__init__Method · 0.85
joinMethod · 0.85
currentThreadFunction · 0.85

Calls 1

_DummyThreadClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…