Esempio n. 1
0
/**
 * A wrapper for poll() that falls back to select() when poll() is missing.
 */
int
compat_poll(struct pollfd *fds, unsigned int n, int timeout)
{
	int r;

	if (timeout != 0)
		thread_in_syscall_set(TRUE);

#ifdef USE_SELECT_FOR_POLL
	r = emulate_poll_with_select(fds, n, timeout);
#elif defined(MINGW32)
	/*
	 * Only Windows versions starting at Vista have WSAPoll(), but we
	 * know all Windows have select() under MinGW.
	 */
	if (mingw_has_wsapoll())
		r = mingw_poll(fds, n, timeout);
	else
		r = emulate_poll_with_select(fds, n, timeout);
#else	/* !USE_SELECT_FOR_POLL */
	r = poll(fds, n, timeout);
#endif	/* USE_SELECT_FOR_POLL */

	if (timeout != 0)
		thread_in_syscall_set(FALSE);

	return r;
}
Esempio n. 2
0
/**
 * A wrapper for poll() that falls back to select() when poll() is missing.
 */
int
compat_poll(struct pollfd *fds, unsigned int n, int timeout)
#ifdef USE_SELECT_FOR_POLL
{
	return emulate_poll_with_select(fds, n, timeout);
}