On Tue, Nov 04, 2025 at 12:25:38PM +0100, Kevin Wolf wrote:
> Am 03.11.2025 um 21:10 hat Eric Blake geschrieben:

> > 
> > That said, it is more robust to remember when a callback function is
> > tied to a non-default context, and have both the sync wait and any
> > late address additions honor that same context.  That way, the code
> > will be robust even if a later user performs a sync wait for a
> > specific client in the middle of servicing a longer-lived
> > QIONetListener that has an async callback for all other clients.
> > 
> > Signed-off-by: Eric Blake <[email protected]>
> 
> > @@ -160,6 +160,7 @@ void 
> > qio_net_listener_set_client_func_full(QIONetListener *listener,
> >      listener->io_func = func;
> >      listener->io_data = data;
> >      listener->io_notify = notify;
> > +    listener->context = context;
> 
> Now that you show me this, I think patch 2 actually also needs to check
> that context is unchanged. We don't remember the old value before this
> patch, so maybe the order of patch 2 and 3 should be swapped.

Makes sense.  v2 will swap the patch order, and ensure the context is
unchanged when optimizing a re-arm of the already-existing callback.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org


Reply via email to