| 69 | static PyMethodDef timerJobWrapperDef = {"timerJobWrapper", timerJobWrapper, METH_VARARGS, NULL}; |
| 70 | |
| 71 | PyEventLoop::AsyncHandle PyEventLoop::enqueue(PyObject *jobFn) { |
| 72 | PyEventLoop::_locker->incCounter(); |
| 73 | PyObject *wrapper = PyCFunction_New(&loopJobWrapperDef, jobFn); |
| 74 | // Enqueue job to the Python event-loop |
| 75 | // https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.call_soon |
| 76 | PyObject *asyncHandle = PyObject_CallMethod(_loop, "call_soon_threadsafe", "O", wrapper); |
| 77 | return PyEventLoop::AsyncHandle(asyncHandle); |
| 78 | } |
| 79 | |
| 80 | static PyObject *_enqueueWithDelay(PyObject *_loop, PyEventLoop::AsyncHandle::id_t handleId, PyObject *jobFn, double delaySeconds, bool repeat) { |
| 81 | PyObject *wrapper = PyCFunction_New(&timerJobWrapperDef, jobFn); |
no test coverage detected