From f51b5f268b7c127266fe19a0dcb3e244034bcd10 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 14 Dec 2011 17:03:03 -0800 Subject: uhd: make use of TEMP_FAILURE_RETRY when select() --- host/lib/transport/udp_common.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'host/lib/transport/udp_common.hpp') diff --git a/host/lib/transport/udp_common.hpp b/host/lib/transport/udp_common.hpp index 47775d9c4..bf4712613 100644 --- a/host/lib/transport/udp_common.hpp +++ b/host/lib/transport/udp_common.hpp @@ -44,8 +44,15 @@ namespace uhd{ namespace transport{ FD_ZERO(&rset); FD_SET(sock_fd, &rset); + //http://www.gnu.org/s/hello/manual/libc/Interrupted-Primitives.html + //This macro is provided with gcc to properly deal with EINTR. + //If not provided, define an empty macro, assume that is OK + #ifndef TEMP_FAILURE_RETRY + #define TEMP_FAILURE_RETRY(x) (x) + #endif + //call select with timeout on receive socket - return ::select(sock_fd+1, &rset, NULL, NULL, &tv) > 0; + return TEMP_FAILURE_RETRY(::select(sock_fd+1, &rset, NULL, NULL, &tv)) > 0; } }} //namespace uhd::transport -- cgit v1.2.3