Chromium Code Reviews| Index: base/posix/eintr_wrapper.h |
| diff --git a/base/posix/eintr_wrapper.h b/base/posix/eintr_wrapper.h |
| index 8e26752337066162e14f0c65a1a06f41985d619f..854c43a67cba848f418cb4a3ad901393590b1d7b 100644 |
| --- a/base/posix/eintr_wrapper.h |
| +++ b/base/posix/eintr_wrapper.h |
| @@ -9,6 +9,9 @@ |
| // caller will nonetheless see an EINTR in Debug builds. |
| // |
| // On Windows, this wrapper macro does nothing. |
| +// |
| +// Don't wrap close calls in HANDLE_EINTR. Use IGNORE_EINTR if the return |
| +// value of close is significant. See http://crbug.com/269623. |
| #ifndef BASE_POSIX_EINTR_WRAPPER_H_ |
| #define BASE_POSIX_EINTR_WRAPPER_H_ |
| @@ -20,6 +23,7 @@ |
| #include <errno.h> |
| #if defined(NDEBUG) |
| + |
| #define HANDLE_EINTR(x) ({ \ |
| typeof(x) eintr_wrapper_result; \ |
| do { \ |
| @@ -42,9 +46,21 @@ |
| #endif // NDEBUG |
| +#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; \ |
|
jln (very slow on Chromium)
2013/12/02 23:50:31
Shouldn't you patch errno as well ?
Mark Mentovai
2013/12/03 03:30:53
jln wrote:
|
| + } \ |
| + } while (0); \ |
| + eintr_wrapper_result; \ |
| +}) |
| + |
| #else |
| #define HANDLE_EINTR(x) (x) |
| +#define IGNORE_EINTR(x) (x) |
| #endif // OS_POSIX |