On Wed, Feb 28, 2018 at 01:06:32PM +0800, Peter Xu wrote: > This is the part of work to allow the QIOTask to use a different > gcontext rather than the default main gcontext, by providing > qio_task_context_set() API. > > We have done some work before on doing similar things to add non-default > gcontext support. The general idea is that we delete the old GSource > from the main context, then re-add a new one to the new context when > context changed to a non-default one. However this trick won't work > easily for threaded QIOTasks since we can't easily stop a real thread > and re-setup the whole thing from the very beginning.
I think this entire usage pattern is really broken. We should not provide a way to change the GMainContext on an existing task. We should always just set the correct GMainContxt right from the start. This will avoid much of the complexity you're introducing into this patch series, and avoid having to expose GTasks to the callers of the async methods at all. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
