diff options
author | Josh Blum <josh@joshknows.com> | 2011-12-14 17:03:03 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-12-16 11:22:23 -0800 |
commit | d74f81a7e9456f1cd821e44c70d7ca476969738e (patch) | |
tree | 507a18d16061fe9f07c23c96ca08b424afbba79f | |
parent | 6aeaef4c772e61d7a5913469ab8e6c822b11ef2a (diff) | |
download | uhd-d74f81a7e9456f1cd821e44c70d7ca476969738e.tar.gz uhd-d74f81a7e9456f1cd821e44c70d7ca476969738e.tar.bz2 uhd-d74f81a7e9456f1cd821e44c70d7ca476969738e.zip |
uhd: make use of TEMP_FAILURE_RETRY when select()
-rw-r--r-- | host/lib/transport/udp_common.hpp | 9 |
1 files changed, 8 insertions, 1 deletions
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 |