| 112 | } |
| 113 | |
| 114 | bool sendJobToMainLoop(PyObject *pyFunc) { |
| 115 | PyGILState_STATE gstate = PyGILState_Ensure(); |
| 116 | |
| 117 | // Send job to the running Python event-loop on cx's thread (the main thread) |
| 118 | PyEventLoop loop = PyEventLoop::getMainLoop(); |
| 119 | if (!loop.initialized()) { |
| 120 | PyGILState_Release(gstate); |
| 121 | return false; |
| 122 | } |
| 123 | loop.enqueue(pyFunc); |
| 124 | |
| 125 | loop._loop = nullptr; // the `Py_XDECREF` Python API call in `PyEventLoop`'s destructor will not be accessible once we hand over the GIL by `PyGILState_Release` |
| 126 | PyGILState_Release(gstate); |
| 127 | return true; |
| 128 | } |
| 129 | |
| 130 | void JobQueue::promiseRejectionTracker(JSContext *cx, |
| 131 | bool mutedErrors, |
nothing calls this directly
no test coverage detected