[vlc-devel] commit: net_Write: always a cancellation point as promised ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Feb 14 16:15:21 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 14 17:15:09 2010 +0200| [4396c68b8933a10b1ca4b99092a60c16670f06d3] | committer: Rémi Denis-Courmont 

net_Write: always a cancellation point as promised

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4396c68b8933a10b1ca4b99092a60c16670f06d3
---

 src/network/io.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/network/io.c b/src/network/io.c
index ab72eba..23d23f1 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -428,8 +428,11 @@ ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
         { .fd = vlc_object_waitpipe (p_this), .events = POLLIN  },
     };
 
-    if (ufd[1].fd == -1)
+    if (unlikely(ufd[1].fd == -1))
+    {
+        vlc_testcancel ();
         return -1;
+    }
 
     while( i_data > 0 )
     {
@@ -486,6 +489,9 @@ ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
         i_total += val;
     }
 
+    if (unlikely(i_data == 0))
+        vlc_testcancel (); /* corner case */
+
     if ((i_total > 0) || (i_data == 0))
         return i_total;
 




More information about the vlc-devel mailing list