summaryrefslogtreecommitdiff
path: root/src/fd.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:04:30 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:04:30 +0900
commit35797d6c69032fc9eaa472c501b7fbba8e388026 (patch)
treee2405b4d548078506fd80fcf2171d0988d0da561 /src/fd.hpp
parent746cabf4868ff4b9bf46e01a16b43943c8e9454c (diff)
Polling handle is a fixed type now.
Polling handle type was previously dependent on polling mechanism used. Now it is void* in all cases. This patch is a first step in the long way to separate the transports from the core library. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/fd.hpp')
-rw-r--r--src/fd.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/fd.hpp b/src/fd.hpp
index 06689fa..d994637 100644
--- a/src/fd.hpp
+++ b/src/fd.hpp
@@ -30,17 +30,26 @@
namespace xs
{
+
#ifdef XS_HAVE_WINDOWS
#if defined _MSC_VER &&_MSC_VER <= 1400
typedef UINT_PTR fd_t;
enum {retired_fd = (fd_t)(~0)};
+ inline void *fdtoptr (fd_t fd_) {return (void*) fd_;}
+ inline fd_t ptrtofd (void *ptr_) {return (fd_t) ptr_;}
#else
typedef SOCKET fd_t;
enum {retired_fd = INVALID_SOCKET};
+ inline void *fdtoptr (fd_t fd_) {return (void*) fd_;}
+ inline fd_t ptrtofd (void *ptr_) {return (fd_t) ptr_;}
#endif
#else
typedef int fd_t;
enum {retired_fd = -1};
+ inline void *fdtoptr (fd_t fd_) {return (void*) fd_;}
+ inline fd_t ptrtofd (void *ptr_) {return (int) ((char*) ptr_ - (char*) 0);}
#endif
+
}
+
#endif