MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / _getMainThread

Method _getMainThread

src/PyEventLoop.cc:214–223  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

212
213/* static */
214PyThreadState *PyEventLoop::_getMainThread() {
215 // The last element in the linked-list of threads associated with the main interpreter should be the main thread
216 // (The first element is the current thread, see https://github.com/python/cpython/blob/7cb3a44/Python/pystate.c#L291-L293)
217 PyInterpreterState *interp = PyInterpreterState_Main();
218 PyThreadState *tstate = PyInterpreterState_ThreadHead(interp);
219 while (PyThreadState_Next(tstate) != nullptr) {
220 tstate = PyThreadState_Next(tstate);
221 }
222 return tstate;
223}
224
225/* static inline */
226PyThreadState *PyEventLoop::_getCurrentThread() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected