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

2015-04-17 Thread Daniel P. Berrange
On Fri, Apr 17, 2015 at 07:06:04PM +0200, Paolo Bonzini wrote: > > > On 17/04/2015 18:11, Daniel P. Berrange wrote: > > > > +task = qio_task_new(OBJECT(ioc), > > +func, opaque, destroy); > > + > > +qio_channel_tls_handshake_task(ioc, task); > > + > > +object_u

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

2015-04-17 Thread Paolo Bonzini
On 17/04/2015 18:11, Daniel P. Berrange wrote: > > +task = qio_task_new(OBJECT(ioc), > +func, opaque, destroy); > + > +qio_channel_tls_handshake_task(ioc, task); > + > +object_unref(OBJECT(task)); > > The second ref taken at time of qio_channel_add_watch_full

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

2015-04-17 Thread Daniel P. Berrange
On Fri, Apr 17, 2015 at 05:57:24PM +0200, Paolo Bonzini wrote: > > > On 17/04/2015 17:49, Daniel P. Berrange wrote: > > > 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 objec

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

2015-04-17 Thread Daniel P. Berrange
On Fri, Apr 17, 2015 at 05:16:26PM +0200, Paolo Bonzini wrote: > > > 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 compl

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

2015-04-17 Thread Paolo Bonzini
On 17/04/2015 17:49, Daniel P. Berrange wrote: > > 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_tas

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

2015-04-17 Thread Paolo Bonzini
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 provi

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

2015-04-17 Thread Daniel P. Berrange
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