diff options
Diffstat (limited to 'src/common/linux/eintr_wrapper.h')
-rw-r--r-- | src/common/linux/eintr_wrapper.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/common/linux/eintr_wrapper.h b/src/common/linux/eintr_wrapper.h index 20b6bed1..35e5e245 100644 --- a/src/common/linux/eintr_wrapper.h +++ b/src/common/linux/eintr_wrapper.h @@ -37,11 +37,22 @@ // #define HANDLE_EINTR(x) ({ \ - typeof(x) __eintr_result__; \ + typeof(x) eintr_wrapper_result; \ do { \ - __eintr_result__ = x; \ - } while (__eintr_result__ == -1 && errno == EINTR); \ - __eintr_result__;\ + eintr_wrapper_result = (x); \ + } while (eintr_wrapper_result == -1 && errno == EINTR); \ + eintr_wrapper_result; \ +}) + +#define IGNORE_EINTR(x) ({ \ + typeof(x) eintr_wrapper_result; \ + do { \ + eintr_wrapper_result = (x); \ + if (eintr_wrapper_result == -1 && errno == EINTR) { \ + eintr_wrapper_result = 0; \ + } \ + } while (0); \ + eintr_wrapper_result; \ }) #endif // COMMON_LINUX_EINTR_WRAPPER_H_ |