* Jonathan Neuschäfer <j.neuschae...@gmx.net> [13/01/24 22:00]: > > ssize_t > > coeio_custom(ssize_t (*func)(va_list ap), ev_tstamp timeout, ...) > > { > > struct coeio_task task; > > task.fiber = fiber; > > task.func = func; > > task.result = -1; > > va_start(task.ap, timeout); > > struct eio_req *req = eio_custom(coeio_custom_cb, 0, > > coeio_on_complete, &task); > > if (req == NULL) { > > errno = ENOMEM; > > } else if (fiber_yield_timeout(timeout)) { > > /* timeout. */ > > errno = ETIMEDOUT; > > task.result = -1; > > eio_cancel(req); > > I think you need to yield here again, and wait for the on_complete > callback to wake you up.
In case of gethostbyname() that would render timeouts basically useless. But what I could do indeed, is in the event of timeout delegate destruction of task resources to on_complete callback. But if you unwind to the beginning of the thread, on_complete callback is not invoked (at least judging by what I see in the code, but contrary to what is written in the docs). -- http://tarantool.org - an efficient, extensible in-memory data store _______________________________________________ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev