aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport/udp_simple.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-11-18 15:43:50 -0800
committerJosh Blum <josh@joshknows.com>2010-11-18 15:43:50 -0800
commitdd03a2a0dff2d34e7ffca95531eaa42c85fd756c (patch)
tree7ea89df802af80caed907d18173f990689662764 /host/lib/transport/udp_simple.cpp
parent28d49657a959feeec9142094735fb4e184c3e9a4 (diff)
parent89ae5f3f651cff22226e2b2c0ce0ed796dad4c71 (diff)
downloaduhd-dd03a2a0dff2d34e7ffca95531eaa42c85fd756c.tar.gz
uhd-dd03a2a0dff2d34e7ffca95531eaa42c85fd756c.tar.bz2
uhd-dd03a2a0dff2d34e7ffca95531eaa42c85fd756c.zip
Merge branches 'master' and 'master' of ettus.sourcerepo.com:ettus/uhdpriv
Diffstat (limited to 'host/lib/transport/udp_simple.cpp')
-rw-r--r--host/lib/transport/udp_simple.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/host/lib/transport/udp_simple.cpp b/host/lib/transport/udp_simple.cpp
index 5829b462b..6799ac7b2 100644
--- a/host/lib/transport/udp_simple.cpp
+++ b/host/lib/transport/udp_simple.cpp
@@ -35,6 +35,8 @@ using namespace uhd::transport;
static bool wait_available(
boost::asio::ip::udp::socket &socket, double timeout
){
+ #if defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)
+
//setup timeval for timeout
timeval tv;
tv.tv_sec = 0;
@@ -46,6 +48,17 @@ static bool wait_available(
FD_SET(socket.native(), &rset);
return ::select(socket.native()+1, &rset, NULL, NULL, &tv) > 0;
+
+ #else /*defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)*/
+
+ //FIXME: why does select fail on macintosh?
+ for (size_t i = 0; i < size_t(timeout*1e3); i++){
+ if (socket.available()) return true;
+ boost::this_thread::sleep(boost::posix_time::milliseconds(1));
+ }
+ return false;
+
+ #endif /*defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)*/
}
/***********************************************************************