static int async_wait_fd_write(int fd, int timeout) { struct wsgi_request *wsgi_req = current_wsgi_req(); if (async_add_fd_write(wsgi_req, fd, timeout)) { return -1; } if (uwsgi.schedule_to_main) { uwsgi.schedule_to_main(wsgi_req); } if (wsgi_req->async_timed_out) { wsgi_req->async_timed_out = 0; return 0; } return 1; }
PyObject *py_eventfd_write(PyObject * self, PyObject * args) { int fd, timeout = 0; struct wsgi_request *wsgi_req = py_current_wsgi_req(); if (!PyArg_ParseTuple(args, "i|i", &fd, &timeout)) { return NULL; } if (async_add_fd_write(wsgi_req, fd, timeout)) { return PyErr_Format(PyExc_IOError, "unable to fd %d to the event queue", fd); } return PyString_FromString(""); }