Displaying 2 results from an estimated 2 matches for "nbd_closure".
Did you mean:
nbd_close
2019 Jul 22
0
Re: [libnbd] More thoughts on callbacks and more
...ebug_fn arg of nbd_set_debug_callback. Luckily
> they can all be generated along with the internal machinery to call
> them.
As written above this doesn't quite work. However it could work to
pass an optional free function with the closure. In other words it
would look like:
struct nbd_closure { .cl = my_debug_fn,
.user_data = foo, .free = my_free } cl;
nbd_set_debug_callback (nbd, &cl);
cl->free (cl->user_data) is called if cl->free != NULL when the
closure is no longer used by the library.
This is a bit of a change to the API however.
Rich.
--...
2019 Jul 20
2
[libnbd] More thoughts on callbacks and more
More thoughts on callbacks, etc. following on from:
https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00184
Closure lifetimes
-----------------
Closures could have a lifetime if we had a little bit of support from
the C library. We would generate (from C only):
nbd_set_free_<fn>_<closure> (nbd, free_closure);
which calls free_closure (user_data) as soon as the