summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-11-17 10:30:57 -0800
committerJosh Blum <josh@joshknows.com>2010-11-17 10:30:57 -0800
commit89ae5f3f651cff22226e2b2c0ce0ed796dad4c71 (patch)
tree45e38f9f4c7666763d040411337bae225381f18d /host/lib
parent56876b0ec80371dbbc3817c36d9e9bbfa396814d (diff)
parent8e8c93a268e8e8eec268a5c829f360154ff9d7d0 (diff)
downloaduhd-89ae5f3f651cff22226e2b2c0ce0ed796dad4c71.tar.gz
uhd-89ae5f3f651cff22226e2b2c0ce0ed796dad4c71.tar.bz2
uhd-89ae5f3f651cff22226e2b2c0ce0ed796dad4c71.zip
Merge branch 'mac_fixes' into ranges_fix
Diffstat (limited to 'host/lib')
-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)*/
}
/***********************************************************************