aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport/udp_simple.cpp
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-11-17 18:31:21 -0800
committerNick Foster <nick@nerdnetworks.org>2010-11-17 18:31:21 -0800
commit95cf7753c175e868d1aacaad378bfe74d9454200 (patch)
tree2eef9c811655d7a1b4d0fb020db7fa5125a2adc7 /host/lib/transport/udp_simple.cpp
parent81c9f77306dc82f250bfb2871b8bd7db67a40085 (diff)
parent89ae5f3f651cff22226e2b2c0ce0ed796dad4c71 (diff)
downloaduhd-95cf7753c175e868d1aacaad378bfe74d9454200.tar.gz
uhd-95cf7753c175e868d1aacaad378bfe74d9454200.tar.bz2
uhd-95cf7753c175e868d1aacaad378bfe74d9454200.zip
Merge branch 'master' of ettus.sourcerepo.com:ettus/uhdpriv into flow_ctrl
Conflicts: host/lib/transport/udp_simple.cpp host/lib/usrp/usrp2/mboard_impl.cpp host/lib/usrp/usrp2/usrp2_iface.cpp host/lib/usrp/usrp2/usrp2_regs.hpp
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)*/
}
/***********************************************************************