diff --git a/webrtc/modules/audio_device/android/low_latency_event_posix.cc b/webrtc/modules/audio_device/android/low_latency_event_posix.cc index 4e0c88a4d6..f25b030d04 100644 --- a/webrtc/modules/audio_device/android/low_latency_event_posix.cc +++ b/webrtc/modules/audio_device/android/low_latency_event_posix.cc @@ -20,6 +20,17 @@ 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; \ + }) + namespace webrtc { const LowLatencyEvent::Handle LowLatencyEvent::kInvalidHandle = -1; @@ -61,7 +72,7 @@ bool LowLatencyEvent::Close(Handle* handle) { if (*handle == kInvalidHandle) { return false; } - int retval = HANDLE_EINTR(close(*handle)); + int retval = IGNORE_EINTR(close(*handle)); *handle = kInvalidHandle; return retval == 0; }