[libvirt] [PATCH] docs: Add callback-related info to virStream{Abort, Finish}

Martin Kletzander posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/a7a6fe03d4ff3c2caf5de1e27e25ac49e48d68d7.1497968124.git.mkletzan@redhat.com
src/libvirt-stream.c | 6 ++++++
1 file changed, 6 insertions(+)
[libvirt] [PATCH] docs: Add callback-related info to virStream{Abort, Finish}
Posted by Martin Kletzander 6 years, 10 months ago
When one has a non-blocking stream and aborts or finishes it without
removing the callback, any event loop invocation will trigger that
callback, but it cannot be removed any more.  We cannot remove the
callback automatically from virStream{Abort,Finish} functions due to
forward-compatibility.  So let's at least document this behaviour,
because it is not easy to find out the reason for.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---

Notes:
    The discussion about the reasons:
    https://www.redhat.com/archives/libvir-list/2017-June/msg00038.html

 src/libvirt-stream.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/libvirt-stream.c b/src/libvirt-stream.c
index d7a8f581608f..c49f20264fd7 100644
--- a/src/libvirt-stream.c
+++ b/src/libvirt-stream.c
@@ -1131,6 +1131,9 @@ virStreamEventRemoveCallback(virStreamPtr stream)
  * errors, so if this returns a success code the application can
  * be sure that all data has been successfully processed.
  *
+ * If the stream is non-blocking, any callback must be removed
+ * beforehand.
+ *
  * Returns 0 on success, -1 upon error
  */
 int
@@ -1170,6 +1173,9 @@ virStreamFinish(virStreamPtr stream)
  * streams this can be used to inform the driver that it
  * should stop sending data.
  *
+ * If the stream is non-blocking, any callback must be removed
+ * beforehand.
+ *
  * Returns 0 on success, -1 upon error
  */
 int
-- 
2.13.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] docs: Add callback-related info to virStream{Abort, Finish}
Posted by John Ferlan 6 years, 9 months ago

On 06/20/2017 10:15 AM, Martin Kletzander wrote:
> When one has a non-blocking stream and aborts or finishes it without
> removing the callback, any event loop invocation will trigger that
> callback, but it cannot be removed any more.  We cannot remove the
> callback automatically from virStream{Abort,Finish} functions due to
> forward-compatibility.  So let's at least document this behaviour,
> because it is not easy to find out the reason for.
> 
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---
> 
> Notes:
>     The discussion about the reasons:
>     https://www.redhat.com/archives/libvir-list/2017-June/msg00038.html
> 
>  src/libvirt-stream.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list