Fixed a crash caused by yadif deinterlacer on Windows XP
[vlc/solaris.git] / src / network / poll.c
blobda78f7fd23d7d4c2e941b41a42908584c48ba984
1 /*****************************************************************************
2 * poll.c: I/O event multiplexing
3 *****************************************************************************
4 * Copyright © 2007 Rémi Denis-Courmont
5 * $Id$
7 * Author: Rémi Denis-Courmont
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifdef HAVE_CONFIG_H
25 # include "config.h"
26 #endif
28 #include <vlc_common.h>
30 #ifdef HAVE_MAEMO
31 # include <vlc_network.h>
32 # include <signal.h>
33 # include <errno.h>
34 # include <poll.h>
36 int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
38 struct timespec tsbuf, *ts;
39 sigset_t set;
40 int canc, ret;
42 if (timeout != -1)
44 div_t d = div (timeout, 1000);
45 tsbuf.tv_sec = d.quot;
46 tsbuf.tv_nsec = d.rem * 1000000;
47 ts = &tsbuf;
49 else
50 ts = NULL;
52 pthread_sigmask (SIG_BLOCK, NULL, &set);
53 sigdelset (&set, SIGRTMIN);
55 canc = vlc_savecancel ();
56 ret = ppoll (fds, nfds, ts, &set);
57 vlc_restorecancel (canc);
59 vlc_testcancel ();
60 return ret;
63 #elif defined (HAVE_POLL)
64 # include <vlc_network.h>
66 struct pollfd;
68 int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
70 (void)fds; (void)nfds; (void)timeout;
71 abort ();
74 #else
75 # error poll() not implemented!
76 #endif