From 0e2d3b7b6c964e0ca4f0a4fb688c80f9704dafd5 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sun, 18 Mar 2007 04:51:40 +0000 Subject: Code refactoring, extracting a new function wait_ms() from Curl_select and Curl_poll() which is called whenever not a single valid file descriptor is passed to these functions. Improve readibility using a poll() macro to replace WSApoll(). --- lib/select.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'lib/select.h') diff --git a/lib/select.h b/lib/select.h index e0844b1d6..c5a9c1059 100644 --- a/lib/select.h +++ b/lib/select.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -23,13 +23,30 @@ * $Id$ ***************************************************************************/ +#include "setup.h" + #ifdef HAVE_SYS_POLL_H #include -#elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) -/* for Vista, use WSAPoll(). */ -#include -#define CURL_HAVE_WSAPOLL -#else +#endif + +/* + * poll() function on Windows Vista and later is called WSAPoll() + */ + +#if defined(USE_WINSOCK) && (USE_WINSOCK > 1) && \ + defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) +#undef HAVE_POLL +#define HAVE_POLL 1 +#undef HAVE_POLL_FINE +#define HAVE_POLL_FINE 1 +#define poll(x,y,z) WSAPoll((x),(y),(z)) +#endif + +/* + * Definition of pollfd struct and constants for platforms lacking them. + */ + +#ifndef HAVE_POLL #define POLLIN 0x01 #define POLLPRI 0x02 @@ -60,4 +77,4 @@ int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes, fd_set* excepts, struct timeval* tv); #endif -#endif +#endif /* __SELECT_H */ -- cgit v1.2.1