Patch: fix libeio cancellation

Marc Lehmann schmorp at
Tue Aug 19 01:06:20 CEST 2014

On Mon, Aug 18, 2014 at 01:28:55PM +0200, Hongli Lai <hongli at> wrote:
> 1. If I cancel eio_open(), and the system call has already finished,
> then if the callback isn't called, the file descriptor becomes lost
> and there would be no way to close it.

I am not sure why you think that, does IO::AIO lose fd's on cancelled
requests? If yes, I'd like to understand how it happens.

> 2. The user data that I pass to eio functions is allocated on the
> heap. Currently, I free the user data in the callback. If the callback
> isn't called, then I would have to introduce additional book keeping
> data structures and timers just to clean up the user data correctly.
> This would introduce all sorts of new code paths, significantly
> increasing the complexity of my codebase.

Same thing, I don't see a lot of this in IO::AIO, in both cases, the
resources will be freed when the request is destroyed. I would say doing
it in the completion callback involves more bookkeeping.

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

More information about the libev mailing list