diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-10-31 15:07:59 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-10-31 15:07:59 +0000 |
commit | 60e5ad760f21d676fa37ff7026ce521ebbbe3bc9 (patch) | |
tree | fc399d968e3a5de6e263248b6f0784ea5743d5a2 /cpp/src/Ice/TcpTransceiver.cpp | |
parent | Fix (diff) | |
download | ice-60e5ad760f21d676fa37ff7026ce521ebbbe3bc9.tar.bz2 ice-60e5ad760f21d676fa37ff7026ce521ebbbe3bc9.tar.xz ice-60e5ad760f21d676fa37ff7026ce521ebbbe3bc9.zip |
Use poll() instead of select() on Unix.
Diffstat (limited to 'cpp/src/Ice/TcpTransceiver.cpp')
-rw-r--r-- | cpp/src/Ice/TcpTransceiver.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp index 69cfafa432a..1a06809bb1a 100644 --- a/cpp/src/Ice/TcpTransceiver.cpp +++ b/cpp/src/Ice/TcpTransceiver.cpp @@ -122,6 +122,7 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout) int rs; assert(_fd != INVALID_SOCKET); +#ifdef _WIN32 FD_SET(_fd, &_wFdSet); if(timeout >= 0) @@ -135,7 +136,12 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout) { rs = ::select(static_cast<int>(_fd + 1), 0, &_wFdSet, 0, 0); } - +#else + struct pollfd pollFd[1]; + pollFd[0].fd = _fd; + pollFd[0].events = POLLOUT; + rs = ::poll(pollFd, 1, timeout); +#endif if(rs == SOCKET_ERROR) { if(interrupted()) @@ -238,6 +244,7 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout) int rs; assert(_fd != INVALID_SOCKET); +#ifdef _WIN32 FD_SET(_fd, &_rFdSet); if(timeout >= 0) @@ -251,7 +258,12 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout) { rs = ::select(static_cast<int>(_fd + 1), &_rFdSet, 0, 0, 0); } - +#else + struct pollfd pollFd[1]; + pollFd[0].fd = _fd; + pollFd[0].events = POLLIN; + rs = ::poll(pollFd, 1, timeout); +#endif if(rs == SOCKET_ERROR) { if(interrupted()) |