On Wed, Feb 28, 2018 at 09:20:47AM +0000, Daniel P. Berrangé wrote: > On Wed, Feb 28, 2018 at 01:06:30PM +0800, Peter Xu wrote: > > Let qio_channel_socket_connect_async() return the created QIOTask object > > for the async connection. In tcp chardev, cache that in SocketChardev > > for further use. With the QIOTask refcount, this is pretty safe. > > Why do you want to return QIOTask ? This is going against the intended > design pattern for QIOTask (that was based on that in GLib). The task > supposed to be an internal use only helper that callers should never > be touching until the completion callback is invoked.
I proposed another solution in the other comment reply to split the threaded QIO task into create() and run(). If you like that, I can try. Any other suggestion would be welcomed too. Thanks, -- Peter Xu