Patch: fix libeio cancellation

Marc Lehmann schmorp at
Fri Aug 29 13:57:03 CEST 2014

On Fri, Aug 29, 2014 at 01:49:46PM +0200, Hongli Lai <hongli at> wrote:
> I know that libeio does not own the fd. But that was not my point. My point
> is: after libeio has created an fd with open(),

Well, you haven't mentioned open so far, but even with open, all you need is
to find out whether the request is still needed, and if not, close the fd.

If you can do it in the request callback you can also do it in the destroy

One could argue about making this automatic for those requests that create
fds, but this isn't being done at the moment.

> (because of the cancellation flag) and does not tell my code what the
> created fd is (because the callback is not called). How can my code
> possibly figure out what the fd is, so that i can close it?

Presumably, by looking at the request. When in doubt, initialise the
result to -1 and check whether it has been changed (it will not change if
the request was skipped).

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list