qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v1 RFC 25/34] io: add QIOTask class for async op


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v1 RFC 25/34] io: add QIOTask class for async operations
Date: Fri, 17 Apr 2015 17:16:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 17/04/2015 16:22, Daniel P. Berrange wrote:
> A number of I/O operations need to be performed asynchronously
> to avoid blocking the main loop. The caller of such APIs need
> to provide a callback to be invoked on completion/error and
> need access to the error, if any. The small QIOTask provides
> a simple framework for dealing with such probes. The API
> docs inline provide an outline of how this is to be used.
> 
> In this series, the QIOTask class will be used for things like
> the TLS handshake, the websockets handshake and TCP connect()
> progress.

Is this actually worth making it a heavyweight QOM object?  In general
if you don't do object_property_add_child (and I don't think here you
do), it's simpler to just make it a C struct.

In this case I even think you're leaking the task.  You do object_ref
twice (once at creation time, once before qio_channel_add_watch_full)
and only have one object_unref.  I would just do without reference
counting, and add a qio_task_free() function that calls
qio_task_finalize() and frees the QIOTask.

BTW, do you have plans to use the GDestroyNotify argument to
qio_task_new, or is it just for consistency?

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]