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

Function eventLoopJobWrapper

src/PyEventLoop.cc:19–33  ·  view source on GitHub ↗

* @brief Wrapper to decrement the counter of queueing event-loop jobs after the job finishes */

Source from the content-addressed store, hash-verified

17 * @brief Wrapper to decrement the counter of queueing event-loop jobs after the job finishes
18 */
19static PyObject *eventLoopJobWrapper(PyObject *jobFn, PyObject *Py_UNUSED(_)) {
20 PyObject *ret = PyObject_CallObject(jobFn, NULL);
21 Py_XDECREF(ret); // don't care about its return value
22
23 PyObject *type, *value, *traceback;
24 PyErr_Fetch(&type, &value, &traceback); // Protects `decCounter()`. If the error indicator is set, Python cannot make further function calls.
25 PyEventLoop::_locker->decCounter();
26 PyErr_Restore(type, value, traceback);
27
28 if (PyErr_Occurred()) {
29 return NULL;
30 } else {
31 Py_RETURN_NONE;
32 }
33}
34static PyMethodDef loopJobWrapperDef = {"eventLoopJobWrapper", eventLoopJobWrapper, METH_NOARGS, NULL};
35
36static PyObject *_enqueueWithDelay(PyObject *_loop, PyEventLoop::AsyncHandle::id_t handleId, PyObject *jobFn, double delaySeconds, bool repeat);

Callers

nothing calls this directly

Calls 1

decCounterMethod · 0.80

Tested by

no test coverage detected