Patch: fix libeio cancellation

Hongli Lai hongli at phusion.nl
Mon Aug 18 13:28:55 CEST 2014


On Mon, Aug 18, 2014 at 6:34 AM, Marc Lehmann <schmorp at schmorp.de> wrote:
> I think it is the eio documentation which is in error here (after
> all, it's still unfinished and uncorrected), and plan to fix this by
> correcting eio.pod, unless you can present an overriding reason to change
> the behaviour - I can't see one, though, as request cancellation is
> asynchronous, and there is no way to see if a result was partial or not.

I'd like to see the callback *always* being called, even when
canceled, for two reasons:

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.

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.

-- 
Phusion | Web Application deployment, scaling, and monitoring solutions

Web: http://www.phusion.nl/
E-mail: info at phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)



More information about the libev mailing list