Commit e228d34c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Inline vlc_poll()

parent e63dd4e1
...@@ -274,9 +274,6 @@ struct pollfd ...@@ -274,9 +274,6 @@ struct pollfd
unsigned revents; unsigned revents;
}; };
#endif #endif
#ifndef HAVE_POLL
# define poll(a, b, c) vlc_poll(a, b, c)
#endif
#ifndef HAVE_IF_NAMEINDEX #ifndef HAVE_IF_NAMEINDEX
#include <errno.h> #include <errno.h>
......
...@@ -160,10 +160,6 @@ VLC_API ssize_t net_Printf( vlc_object_t *p_this, int fd, const v_socket_t *, co ...@@ -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 ); 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) #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 #ifdef WIN32
/* Microsoft: same semantic, same value, different name... go figure */ /* Microsoft: same semantic, same value, different name... go figure */
# define SHUT_RD SD_RECEIVE # define SHUT_RD SD_RECEIVE
......
...@@ -396,6 +396,24 @@ struct vlc_cleanup_t ...@@ -396,6 +396,24 @@ struct vlc_cleanup_t
vlc_cleanup_data.proc (vlc_cleanup_data.data); \ vlc_cleanup_data.proc (vlc_cleanup_data.data); \
} while (0) } 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 */ #endif /* LIBVLC_USE_PTHREAD_CANCEL */
static inline void vlc_cleanup_lock (void *lock) static inline void vlc_cleanup_lock (void *lock)
......
...@@ -805,22 +805,6 @@ void vlc_control_cancel (int cmd, ...) ...@@ -805,22 +805,6 @@ void vlc_control_cancel (int cmd, ...)
va_end (ap); 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 )) #define Q2LL( q ) ( *( long long * )&( q ))
/*** Clock ***/ /*** Clock ***/
......
...@@ -777,22 +777,6 @@ void vlc_control_cancel (int cmd, ...) ...@@ -777,22 +777,6 @@ void vlc_control_cancel (int cmd, ...)
va_end (ap); 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 ***/ /*** Clock ***/
mtime_t mdate (void) mtime_t mdate (void)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment