[vlc-devel] commit: Win32: wake up select every split tenth of seconds (fix #1949) ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Jan 18 16:01:35 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Jan 18 16:57:47 2009 +0200| [e9c23e9505aafc374b76c840986c3fe3fb9b1cb3] | committer: Rémi Denis-Courmont 

Win32: wake up select every split tenth of seconds (fix #1949)

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

 src/network/poll.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/network/poll.c b/src/network/poll.c
index dc1482c..553a7e5 100644
--- a/src/network/poll.c
+++ b/src/network/poll.c
@@ -85,6 +85,18 @@ int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
             FD_SET (fd, &exset);
     }
 
+#ifndef HAVE_ALERTABLE_SELECT
+# warning FIXME! Fix cancellation and remove this crap.
+resume:
+    vlc_testcancel ();
+
+    if ((timeout < 0) || (timeout > 50))
+    {
+        tv.tv_sec = 0;
+        tv.tv_usec = 50;
+    }
+    else
+#endif
     if (timeout >= 0)
     {
         div_t d = div (timeout, 1000);
@@ -94,6 +106,18 @@ int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
 
     val = select (val + 1, &rdset, &wrset, &exset,
                   (timeout >= 0) ? &tv : NULL);
+
+#ifndef HAVE_ALERTABLE_SELECT
+# warning FIXME! Fix cancellation and remove this crap.
+    if (val == 0)
+    {
+        if (timeout > 0)
+            timeout -= (timeout > 50) ? 50 : timeout;
+        if (timeout != 0)
+            goto resume;
+    }
+#endif
+
     if (val == -1)
         return -1;
 




More information about the vlc-devel mailing list