[vlc-devel] [PATCH] vlc_threads: fix the cancelation of vlc_poll()

KO Myung-Hun komh78 at gmail.com
Sun Feb 3 15:45:59 CET 2013


If timeout is negative, cancelation does not work. And time slice for poll()
should be 50ms not timeout itself.
---
 include/vlc_threads.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 7c6a4ca..f232632 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -390,12 +390,13 @@ static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
 {
     vlc_testcancel ();
 
-    while (timeout > 50)
+    while (timeout < 0 || timeout > 50)
     {
-        int val = poll (fds, nfds, timeout);
+        int val = poll (fds, nfds, 50);
         if (val != 0)
             return val;
-        timeout -= 50;
+        if (timeout > 50 )
+            timeout -= 50;
         vlc_testcancel ();
     }
 
-- 
1.7.3.2




More information about the vlc-devel mailing list