[vlc-commits] os2: refactorize poll() implementation
KO Myung-Hun
git at videolan.org
Sun Feb 5 02:04:24 CET 2017
vlc | branch: master | KO Myung-Hun <komh78 at gmail.com> | Sun Feb 5 01:05:55 2017 +0900| [335ce5b02a0f13893e8a3fc54c400230cdb3ac8e] | committer: Jean-Baptiste Kempf
os2: refactorize poll() implementation
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=335ce5b02a0f13893e8a3fc54c400230cdb3ac8e
---
src/os2/thread.c | 50 ++++++++++++++------------------------------------
1 file changed, 14 insertions(+), 36 deletions(-)
diff --git a/src/os2/thread.c b/src/os2/thread.c
index 35dd008..20f7ccd 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -826,47 +826,25 @@ int vlc_poll_os2( struct pollfd *fds, unsigned nfds, int timeout )
FD_SET( fd, &exset );
}
+ if( non_sockets > 0 )
+ timeout = 0; /* Just check pending sockets */
+
/* Sockets included ? */
- if( val != -1 )
+ if( val != -1)
{
- fd_set saved_rdset = rdset;
- fd_set saved_wrset = wrset;
- fd_set saved_exset = exset;
+ struct timeval *ptv = NULL;
- /* Check pending sockets */
- switch( vlc_select( val + 1, &rdset, &wrset, &exset, &tv ))
+ if( timeout >= 0 )
{
- case -1 : /* Error */
- return -1;
-
- case 0 : /* Timeout */
- /* Socket only ? */
- if( non_sockets == 0 )
- {
- struct timeval *ptv = NULL;
-
- if( timeout >= 0 )
- {
- div_t d = div( timeout, 1000 );
- tv.tv_sec = d.quot;
- tv.tv_usec = d.rem * 1000;
-
- ptv = &tv;
- }
-
- rdset = saved_rdset;
- wrset = saved_wrset;
- exset = saved_exset;
-
- if( vlc_select( val + 1, &rdset, &wrset, &exset, ptv )
- == -1 )
- return -1;
- }
- break;
-
- default: /* Ready */
- break;
+ div_t d = div( timeout, 1000 );
+ tv.tv_sec = d.quot;
+ tv.tv_usec = d.rem * 1000;
+
+ ptv = &tv;
}
+
+ if (vlc_select( val + 1, &rdset, &wrset, &exset, ptv ) == -1)
+ return -1;
}
val = 0;
More information about the vlc-commits
mailing list