aboutsummaryrefslogtreecommitdiff
path: root/lib/select.h
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-03-18 04:51:40 +0000
committerYang Tse <yangsita@gmail.com>2007-03-18 04:51:40 +0000
commit0e2d3b7b6c964e0ca4f0a4fb688c80f9704dafd5 (patch)
tree32a9547c1e697f6b5679117a7061be868fe4a584 /lib/select.h
parent46a50aa001cd0bcec263f06db74433c3a2850cf8 (diff)
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().
Diffstat (limited to 'lib/select.h')
-rw-r--r--lib/select.h31
1 files changed, 24 insertions, 7 deletions
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, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, 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 <sys/poll.h>
-#elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
-/* for Vista, use WSAPoll(). */
-#include <winsock2.h>
-#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 */