[vlc-commits] Inline vlc_poll()
Rémi Denis-Courmont
git at videolan.org
Mon Jan 23 16:23:57 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jan 23 17:23:20 2012 +0200| [e228d34ca5a6d47dc86b31ac9cea45ae19959a0e] | committer: Rémi Denis-Courmont
Inline vlc_poll()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e228d34ca5a6d47dc86b31ac9cea45ae19959a0e
---
include/vlc_fixups.h | 3 ---
include/vlc_network.h | 4 ----
include/vlc_threads.h | 18 ++++++++++++++++++
src/os2/thread.c | 16 ----------------
src/win32/thread.c | 16 ----------------
5 files changed, 18 insertions(+), 39 deletions(-)
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index b5884f4..9a3ed8a 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -274,9 +274,6 @@ struct pollfd
unsigned revents;
};
#endif
-#ifndef HAVE_POLL
-# define poll(a, b, c) vlc_poll(a, b, c)
-#endif
#ifndef HAVE_IF_NAMEINDEX
#include <errno.h>
diff --git a/include/vlc_network.h b/include/vlc_network.h
index c1769b1..431dfd5 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -160,10 +160,6 @@ VLC_API ssize_t net_Printf( vlc_object_t *p_this, int fd, const v_socket_t *, co
VLC_API ssize_t net_vaPrintf( vlc_object_t *p_this, int fd, const v_socket_t *, const char *psz_fmt, va_list args );
#define net_vaPrintf(a,b,c,d,e) net_vaPrintf(VLC_OBJECT(a),b,c,d,e)
-struct pollfd;
-VLC_API int vlc_poll(struct pollfd *fds, unsigned nfds, int timeout);
-
-
#ifdef WIN32
/* Microsoft: same semantic, same value, different name... go figure */
# define SHUT_RD SD_RECEIVE
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 7a6c6af..ca7c180 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -396,6 +396,24 @@ struct vlc_cleanup_t
vlc_cleanup_data.proc (vlc_cleanup_data.data); \
} while (0)
+/* poll() with cancellation */
+static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
+{
+ vlc_testcancel ();
+
+ while (timeout > 50)
+ {
+ int val = poll (fds, nfds, timeout);
+ if (val != 0)
+ return val;
+ timeout -= 50;
+ vlc_testcancel ();
+ }
+
+ return poll (fds, nfds, timeout);
+}
+# define poll(u,n,t) vlc_poll(u, n, t)
+
#endif /* LIBVLC_USE_PTHREAD_CANCEL */
static inline void vlc_cleanup_lock (void *lock)
diff --git a/src/os2/thread.c b/src/os2/thread.c
index e92ef20..3f08658 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -805,22 +805,6 @@ void vlc_control_cancel (int cmd, ...)
va_end (ap);
}
-int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
-{
- vlc_testcancel ();
-
- while (timeout > 50)
- {
- int val = poll (fds, nfds, timeout);
- if (val != 0)
- return val;
- timeout -= 50;
- vlc_testcancel ();
- }
-
- return poll (fds, nfds, timeout);
-}
-
#define Q2LL( q ) ( *( long long * )&( q ))
/*** Clock ***/
diff --git a/src/win32/thread.c b/src/win32/thread.c
index 0cd833d..cd4c454 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -777,22 +777,6 @@ void vlc_control_cancel (int cmd, ...)
va_end (ap);
}
-int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
-{
- vlc_testcancel ();
-
- while (timeout > 50)
- {
- int val = poll (fds, nfds, timeout);
- if (val != 0)
- return val;
- timeout -= 50;
- vlc_testcancel ();
- }
-
- return poll (fds, nfds, timeout);
-}
-
/*** Clock ***/
mtime_t mdate (void)
{
More information about the vlc-commits
mailing list