On Tue, Jul 30, 2019 at 11:51:40AM +0100, Richard W.M. Jones wrote:
Previously discussed here:
https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
It turns out that deferring callbacks is a PITA. (It would be a bit
easier if C has closures.) However by rewriting the example we can
avoid the need to use the cookie at all and make it run a bit more
efficiently, so let's do that instead.
I was going to say also:
The callbacks pass the command cookie back to the caller, and are thus
all potentially racy. There seem to be two possibilities here: (1)
Drop the cookie parameter entirely. (2) Document the possible race so
that users don't use the cookie inappropritely.
I think I favour option (1).
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html