From d74f81a7e9456f1cd821e44c70d7ca476969738e 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(-) 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